Re: New kernel interface for sys_tz and timewarp?
From: Florian Weimer
Date: Tue Aug 13 2019 - 15:31:32 EST
* Paul Eggert:
> Linus Torvalds wrote:
>> I assume/think that glibc uses (a) environment
>> variables and (b) a filesystem-set default (per-user file with a
>> system-wide default? I don't know what people do).
> glibc relies on the TZ environment variable, with a system-wide
> default specified in /etc/localtime or suchlike (there is no
> per-user default). glibc ignores the kernel's 'struct timezone'
> settings for of this, as 'struct timezone' is obsolete/vestigial and
> doesn't contain enough info to do proper conversions anyway.
I think the configuration value that settimeofday changes is not
actually a time zone, but an time offset used to interpret various
things, mostly in a dual-boot environment with Windows, apparently
(Like the default time offset for extracting timetamps from FAT
volumes.)
This data has to come from *somewhere*. The TZ variable and
/etc/localtime cover something else entirely.
Maybe it is possible to replace these things with other mechanisms
which exist today. For example, the mount program could read a
configuration file to determine the system default for the time_offset
mount option and apply the value automatically. The real-time clock
offset could be maintained by whatever mechanism hwclock uses.
I think whatever we end up doing, we should maintain consistency after
a system upgrade after architectures. It does not make sense to keep
using the settimeofday hack on amd64 indefinitely, and switch to a
different mechanism on RV32, so that the two ways of supplying the
offset are never reconciled across architectures.