There are two variants how timezone may change:
- User changed
/etc/localtimesymlink target. - tzdata file content changed due to software upgrade.
Options to implement the handling:
-
Call
tzset()every time before conversion to local time
Cons:- In "minute" mode changes are applied only for next minute.
- Doesn't seem to work for 2nd variant of change (TODO: research).
- Extra syscall for each tick even if timezone info is not changed.
-
Watch
/etc/localtimeand/or tzfile changes with inotify(7).
Cons:- Need to replicate glibc behavior for case when
TZvariable is set. - Need to track full tzdata file path: any component of the path may change.
- Need to replicate glibc behavior for case when
-
Watch
org.freedesktop.timedate1D-Bus property changes (TODO: research).
Cons:- Limited to freedesktop.org compliant systems.
- Depends on D-Bus and systemd service.
-
Trigger tzfile re-read externally from package manager hook and timezone selection tools.
Cons:- Specific to package manager.
- "Timezone selection tools" is a vague concept.
There are two variants how timezone may change:
1. User changed `/etc/localtime` symlink target.
2. tzdata file content changed due to software upgrade.
Options to implement the handling:
* Call `tzset()` every time before conversion to local time
Cons:
- In "minute" mode changes are applied only for next minute.
- Doesn't seem to work for 2nd variant of change (TODO: research).
- Extra syscall for each tick even if timezone info is not changed.
* Watch `/etc/localtime` and/or tzfile changes with inotify(7).
Cons:
- Need to replicate glibc behavior for case when `TZ` variable is set.
- Need to track full tzdata file path: any component of the path may change.
* Watch `org.freedesktop.timedate1` D-Bus property changes (TODO: research).
Cons:
- Limited to freedesktop.org compliant systems.
- Depends on D-Bus and systemd service.
* Trigger tzfile re-read externally from package manager hook and timezone selection tools.
Cons:
- Specific to package manager.
- "Timezone selection tools" is a vague concept.