18 Jul
2022
18 Jul
'22
8:44 a.m.
On Jul 18 2022, Almaz Mingaleev via tz wrote:
Attached code prints "+0000 America/Los_Angeles" both with glibc and with linked ToT strftime implementation. On MacOs it prints "-0800 America/Los_Angeles". Is it a known issue? #include <time.h> #include <stdio.h> #include <stdlib.h>
int main() { struct tm tm = {.tm_mday = 12, .tm_mon = 3, .tm_year = 2022 - 1900, .tm_zone = "America/Los_Angeles"};
You are not setting tm_gmtoff, thus it remains at zero. MacOS probably doesn't have tm_gmtoff. -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."