Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 12 Jun 2017 19:19:18 -0400
From: Rich Felker <>
Subject: Re: detect timezone changes by monitoring /etc/localtime
 (like glibc)

On Tue, Jun 13, 2017 at 09:08:15AM +1000, Patrick Oppenlander wrote:
> On 09/06/17 22: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.
> >
> I found which was helpful.

Nice, I'd forgotten about that.

> Performance could be addressed (inotify?) but it's all moot anyway given
> the other issues mentioned.

I don't think it's as easy as you make it sound. With inotify you
still need a syscall to determine whether there's an event on the
inotify fd and read it. Non-blocking read() might be faster than
stat() but it's still at least 500 times slower then just checking
that the environment variable hasn't changed. There may be a way to
wire up a signal to fire when the inotify fd has data ready, but then
you consume an extra signal for implementation-internal use and have
to deal with managing it.

> >In order for asynchronous timezone changes to be safe, the API would
> >have to be such that you make one call to get the current timezone,
> >then pass it as an argument to functions depending on the timezone, so
> >that the application has control of which timezone is getting used in
> >each call.
> This is how the WIN32 API is implemented.

The glibc developers have discussed a new time[zone] API where
timezones are data objects rather than hidden global state. It might
be worth reading up on what they have in mind and if there are
improvements that should be suggested, and if the results could be
proposed as a standard.


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.