diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2020-02-12 12:23:46 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2020-02-12 12:23:46 -0500 |
commit | 2bdd2d12801eada77945d4f6644248cf7952cc64 (patch) | |
tree | c7a2470fce314bb6abf4c396c2f6a110b11abed1 | |
parent | 60a33ca726518a3325e56d77f65bfdcbecf91444 (diff) | |
download | bfs-2bdd2d12801eada77945d4f6644248cf7952cc64.tar.xz |
parse: Work around missing `timezone` on FreeBSD
FreeBSD has a function timezone() that conflicts with the global
variable, despite that being specified by POSIX. Use tm_gmtoff instead.
-rw-r--r-- | parse.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -1787,8 +1787,13 @@ invalid: fprintf(stderr, " - %04d-%02d-%02d\n", year, month, tm.tm_mday); fprintf(stderr, " - %04d-%02d-%02dT%02d:%02d:%02d\n", year, month, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec); +#if __FreeBSD__ + tz_hour = tm.tm_gmtoff/3600; + tz_min = (labs(tm.tm_gmtoff)/60)%60; +#else tz_hour = -timezone/3600; tz_min = (labs(timezone)/60)%60; +#endif fprintf(stderr, " - %04d-%02d-%02dT%02d:%02d:%02d%+03d:%02d\n", year, month, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, tz_hour, tz_min); |