Boost logo

Boost Users :

Subject: Re: [Boost-users] Question on Posix timezone string
From: Mats Webjörn/WIKAB (konsult_at_[hidden])
Date: 2019-03-10 10:17:02


And yet another issue with to_posix_strings()

The 1.66 date_time_zonespec.csv returns for Europe/Stockholm "CET+01CEST+01,M3.5.0/02:00,M10.5.0/03:00"

It's not only the sign of the offset which is incorrect, the DST offset is also incorrect.

Acc.to POSIX "Environment variables" http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08 for "TZ"

"offset
Indicates the value added to the local time to arrive at Coordinated Universal Time"

So, the DST offset is NOT an offset to be added to the standard (STD) offset. It should be the complete offset to be added to local time to get UTC.

A correct POSIX string should therefore read:

"CET-01CEST-02,M3.5.0/02:00,M10.5.0/03:00"

Regards
Mats Webjörn

Från: Stian Zeljko Vrba [mailto:vrba_at_[hidden]]
Skickat: den 29 december 2018 07:30
Till: Mats Webjörn/WIKAB; boost-users_at_[hidden]
Ämne: Re: [Boost-users] Question on Posix timezone string

To add another data point to the discussion as I've been bitten by the same issue wrt dates and times. I found the following comment in my code while translating local time to utc time by using Windows native and .NET APIs:

// .Net DateTimeOffset contains _local_ ticks + offset, so that utc = local - offset
// Windows TZ information contains bias which is -offset so that utc = local + bias

It seems that there is a difference between "offset" and "bias". [1] contains the following text and formula: "The bias is the difference, in minutes, between Coordinated Universal Time (UTC) and local time [...] UTC = local time + bias." [2] on the other hand operates with offsets and says "The difference between the current DateTimeOffset object's time value and Coordinated Universal Time (UTC)."

So that the TZ table contains negated offsets is plausible.

[1] https://docs.microsoft.com/en-us/windows/desktop/api/timezoneapi/ns-timezoneapi-_time_zone_information

[2] https://docs.microsoft.com/en-us/dotnet/api/system.datetimeoffset.offset?view=netframework-4.7.2



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net