mailing list of musl libc
 help / color / mirror / code / Atom feed
From: "A. Wilcox" <awilfox@adelielinux.org>
To: musl@lists.openwall.com
Subject: Re: detect timezone changes by monitoring /etc/localtime (like glibc)
Date: Fri, 9 Jun 2017 22:36:29 -0500	[thread overview]
Message-ID: <593B693D.9090007@adelielinux.org> (raw)
In-Reply-To: <20170609121502.GO1627@brightrain.aerifal.cx>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 09/06/17 07:15, Rich Felker wrote:
> On Fri, Jun 09, 2017 at 05:15:40PM +1000, Patrick Oppenlander
> wrote:
>> During some recent testing I came across a bug when adjusting
>> timezones on an embedded system by changing /etc/localtime. The
>> cause ended up being a behavioural difference between glibc and
>> musl.
> 
> This difference is intentional; I believe there are past
> discussions in the list archives.
> 
> Aside from the glibc behavior giving abysmal performance (syscalls
> on every time operation), there's a more fundamental issue of
> usability of the results. A common important idiom with time
> functions is to perform several operations together in succession
> to get a result -- for example, obtain the current time as time_t,
> format it with localtime[_r], make some adjustment e.g. for a
> relative time, then call mktime to convert back to time_t. Such
> operations rely on the time zone being consistent for each
> suboperation, which is true as long as the application does not
> modify its own environment, but only assuming libc doesn't impose
> asynchronous changes on the timezone.


Fun and true facts: this has actually revealed itself as a horrible
behaviour in Pidgin.  When I moved from the east coast to the central
US, I woke up my laptop and changed the TZ.  It was running a glibc
Linux at that point.  Pidgin wouldn't make noise or show notifications
until an hour went by; some internal counter had a local time_t and it
thought it was receiving old notifications (since the timezone shifted
backwards an hour).

So this isn't a theoretical problem.  It's a very real one.  (And one
I have yet to experience running musl Linux on my laptop now.)

- --arw

- -- 
A. Wilcox (awilfox)
Project Lead, Adélie Linux
http://adelielinux.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJZO2k6AAoJEMspy1GSK50UcqoP/1+W4LHdIqHjiPLigvKJSuRG
nr1DfpsFDyOxPYZa7fJMvkUrycsgM8o9kWlIuoGss8eqGQa6iW95hk4dVmnzjTOF
YELSQYxZ0X0w2dFYC2i5WwLs5MuG2gjg1Egr70i5i2uFBkm2qkl5qtmX3hGdU6V/
yPtOOaAGvgLgrKxjq5BjlssGVgqhLtPD4Y3cT1HAg6UZMtKHN3hcufeRYbha12VE
UW90k/XcoOOTvZCAAKZrbCbqzAjtuplIOB6uaTjNUpDmlhHXHy+uE4GJOQ3ohdWV
9occL5wGNsj+BM6+4qhhSmBTJdbHxwZ32t+0XWTejE0imDB1Y+zFphGX9utN6PwM
Fkk6BcJTK8tg1/gbXwaHNYNe6L9hnnynnLo2tpWI64zZAgDDhUpkWx4sojAA795q
9AgjcbWucXxFkTA3gZfouWSBWpuOhUBPvvoFo0oIxbhTSzgCSEw+0C7WaVcPlPrh
o7osd8WLm2U7ektOXgVSfOYBTMKYp49DekgVb4xVhSteA0L2p7BzZIxvPc0ebf7k
jHPplp1WcDKJ/wJ6nybVxwRCrHDFa1lZZ62vdotKuzeNcUG2HPPlx68RA0Qsmtzw
UP1yeUefOpoW1wq+jhBcV2HwLRyAZFLYqfuF/zyZ9cCBOBtC1U4uzbN0OBdAdOUX
6kwppw1yXr1xZQudzKjU
=QbW2
-----END PGP SIGNATURE-----


  reply	other threads:[~2017-06-10  3:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-09  7:15 Patrick Oppenlander
2017-06-09 12:15 ` Rich Felker
2017-06-10  3:36   ` A. Wilcox [this message]
2017-06-10  9:57     ` u-uy74
2017-06-10 12:23       ` Rich Felker
2017-06-10 13:23         ` u-uy74
2017-06-12 23:08   ` Patrick Oppenlander
2017-06-12 23:19     ` Rich Felker
2017-06-12 23:49       ` Patrick Oppenlander
2017-06-12 23:58         ` Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=593B693D.9090007@adelielinux.org \
    --to=awilfox@adelielinux.org \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).