[tz] iana build failures on Windows
Brian Inglis
Brian.Inglis at SystematicSw.ab.ca
Fri Apr 23 17:26:50 UTC 2021
On 2021-04-23 01:37, Guy Harris via tz wrote:
> On Apr 22, 2021, at 11:22 PM, Manuela Friedrich via tz wrote:
>> please find the tracing output attached.
>> I have only kept the first 136 lines believing it provides enough information.
>> d:\devsrc\treasure_test\iana\zoneinfo\iana\Africa\Abidjan -9223372036854775808 = NULL
> Is zdump linked with the rest of the tz code, or is it only linked with
the Visual Studio C library?
>
> If it's only linked with the Visual Studio C library, so that the localtime()
> that zdump calls is the Visual Studio C library's localtime(), rather than
> the tz code's localtime(), then it Will Not Work for any time before January
> 1, 1970, 00:00:00 UTC - localtime() in the Visual Studio C library returns
> NULL for all such date/time values:
>
> https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/localtime-localtime32-localtime64?view=msvc-160
As long as you are using 64 bit time functions, with limits from
1970-01-01 00:00:00+0000 @0 ... 3000-12-31 23:59:59+0000 @32535215999
you can work around that, using a 400 year offset to get the time within the
supported range:
$ date -ud '1970-01-01 00:00:00+0000 + 400 years' +@%s
@12622780800
GNU date and related functions should be good between the range (and some months
and days):
$ date -ud '1970-01-01 00:00:00+0000 - 2147483718 years' +%c%z\ @%s
-2147481748 Jan 01 Mon 00:00:00+0000 @-67768040609740800 # - 2^31+70 yr
$ date -ud '1970-01-01 00:00:00+0000 + 2147481677 years' +%c%z\ @%s
2147483647 Jan 01 Tue 00:00:00+0000 @67767976201996800 # + 2^31-1971 yr
--
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada
This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]
More information about the tz
mailing list