[BUG] GTimeZone broken on Windows

Linus Torvalds torvalds at linux-foundation.org
Wed Feb 27 09:58:50 PST 2013


On Wed, Feb 27, 2013 at 9:53 AM, Lutz Vieweg <lvml at 5t9.de> wrote:
>
> So... why is
>
>>         time_t now = time(NULL);
>>         struct tm *local = localtime(&now);
>>         return utc_mktime(local);
>
> better than
>
>  return (timestamp_t)time(NULL);

Try it.

We do all our timestamps as UTC internally. No timezones, no nothing.
We will print out all dates as if they were always UTC.

So when we want to get "local time", we don't want "local time here,
as seen from UTC" (which is what "time()" returns). We want to get
(for example) the time from your email:

    Wed, Feb 27, 2013 at 9:53 AM

and save that. We're basically shaving off all the timezone
information, because none of the dive computers we have access to get
it right anyway, and nobody really cares.

So what we want to get is "what is the time that describes the string
'Wed, Feb 27, 2013 at 9:53 AM' in UTC".

               Linus


More information about the subsurface mailing list