mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: detect timezone changes by monitoring /etc/localtime (like glibc)
Date: Sat, 10 Jun 2017 08:23:04 -0400	[thread overview]
Message-ID: <20170610122304.GP1627@brightrain.aerifal.cx> (raw)
In-Reply-To: <20170610095709.GE30784@example.net>

On Sat, Jun 10, 2017 at 11:57:09AM +0200, u-uy74@aetey.se wrote:
> On Fri, Jun 09, 2017 at 10:36:29PM -0500, A. Wilcox wrote:
> > 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).
> 
> To me it looks like an application [design] bug. Time itself does
> not shift because you are moving to a different angle from the sun,
> so deciding "new" vs "old" should not be concerned with timezones or
> "local time" at all.
> 
> It is the _presentation to humans_ which may need to show
> the "local time" but there is no reason to use it for timekeeping.
> Moreover, there are good reasons to avoid such use.
> 
> > 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.)
> 
> Yes, a real problem, but outside libc, imho.

It's a library issue because, if the invariance of timezone when the
application doesn't intentionally change it is violated on the libc
side, there's no way for applications to meaningfully perform these
kinds of relative operations on local times -- the API is deficient. I
agree the pidgin thing sounds like a pidgin bug (wrongly working with
local times) but there are situations where you need to, or where
you'd prefer to be working in UTC but due to lack of timegm in
standard C, a roundabout route through localtime/mktime and adjustment
for localtime is the only portable solution that's possible.

Rich


  reply	other threads:[~2017-06-10 12:23 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
2017-06-10  9:57     ` u-uy74
2017-06-10 12:23       ` Rich Felker [this message]
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=20170610122304.GP1627@brightrain.aerifal.cx \
    --to=dalias@libc.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).