I am not going to discuss code posted by Albretch, despite it has serious issues from my point of view. This is a response to Greg.

On 20/12/2023 22:04, Greg Wooledge wrote:

The selection of the computer's default time zone by its owner is not
in ANY way related to the computer's geographic location.

The default time zone has nothing to do with systemd, nor with any other
init system that may be in place.  Systemd does not know or care about
the system's default time zone.

See systemd-timedated.service(8) and org.freedesktop.timedate1(5)

busctl introspect org.freedesktop.timedate1 /org/freedesktop/timedate1
# Values are stripped
org.freedesktop.DBus.Properties     interface -
.PropertiesChanged                  signal    sa{sv}as
org.freedesktop.timedate1           interface -
.ListTimezones                      method    -
.SetLocalRTC                        method    bbb
.SetNTP                             method    bb
.SetTime                            method    xbb
.SetTimezone                        method    sb
.CanNTP                             property  b
.LocalRTC                           property  b
.NTP                                property  b
.NTPSynchronized                    property  b
.RTCTimeUSec                        property  t
.TimeUSec                           property  t
.Timezone                           property  s

Desktop environments use this interface.

Again, you're not making any sense.  How does this computer know where
it is geographically located?  Does it have GPS hardware inside it?
And even knowing a user's geographic location is *not* enough to know
which time zone the user wishes to use. Time zones are poliitical.

I would not be surprised to find an "Automatic time zone" checkbox in GUI settings similar to e.g. Android. I am unsure however if it has been implemented by any Debian package. Ubuntu installer is able to guess time zone. Likely it is based on a GeoIP database and an external server to determine outgoing IP address.

List of WiFi networks around is enough to get location without GPS. $LANG may improve this guess to resolve political (ethnic) ambiguity.

My impression is that there are enough users who do not know their timezone and enough users would be happy to get correct timezone automatically. Some of them choose a timezone having slight differences and later complain that the TZ DB is not precise.

To configure default timezone system-wide I still recommend

    dpkg-reconfigure tzdata

since it handles the case of obsolete application. I would not neglect systemd though since it is widespread now. So output of the following commands maybe useful to diagnose issues related to localtime

    timedatectl
    set | grep -E '^(TZ|LANG|LC_.*)='


Reply via email to