Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 05 Mar 2025 21:15:14 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 269207] localtime.c fails to detect mobile device timezone change
Message-ID:  <bug-269207-227-SoEcZYauSz@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-269207-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-269207-227@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D269207

--- Comment #6 from J.R. Oldroyd <fbsd@opal.com> ---
The existing code added when DETECT_TZ_CHANGES is defined does not work
completely as expected.

It does detect changes to /etc/localtime.

However, on occasion, it does not return the correct timezone, defaulting to
"UTC" or timezone "   " (which comes from the WILDABBR code) and causing
programs to receive a UTC result instead of a localtime result.

It seems to fail if called less than 61 seconds after system boot (this is
because the change detection code uses CLOCK_MONOTONIC so it will not trigg=
er
until at least DETECT_TZ_CHANGES_INTERVAL=3D61 seconds after boot).  This c=
auses
programs started at boot to start in UTC timezone even though /etc/localtim=
e is
present and set to another timezone.  An easy fix for this is to return 1 w=
hen
last_checked =3D=3D 0.

It seems to also fail at other times too with an app switching back to UTC
after already having learned the correct timezone.  I've not had time to de=
bug
this yet, but suspect it could have to do with calling tzsetwall() or other
function that causes the timezone name to be reset.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-269207-227-SoEcZYauSz>