]> git.ipfire.org Git - thirdparty/systemd.git/commit
time-util: make parse_timestamp() use the RFC-822/ISO 8601 standard timezone spec
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 13 Feb 2023 18:39:15 +0000 (03:39 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 23 Feb 2023 23:55:27 +0000 (08:55 +0900)
commit7a9afae6040af0417d893328cb44b622dcdcb94f
tree450ca9eba550864e30f63bf211685b40a9545c98
parent97c5f7ba1f50fcd7b982b995b46692c8cad4afaa
time-util: make parse_timestamp() use the RFC-822/ISO 8601 standard timezone spec

If the timezone is specified with a number e.g. +0900 or so, then
let's parse the time as a UTC, and adjust it with the specified time
shift.

Otherwise, if an area has timezone change, e.g.
---
Africa/Casablanca  Sun Jun 17 01:59:59 2018 UT = Sun Jun 17 01:59:59 2018 +00 isdst=0 gmtoff=0
Africa/Casablanca  Sun Jun 17 02:00:00 2018 UT = Sun Jun 17 03:00:00 2018 +01 isdst=1 gmtoff=3600
Africa/Casablanca  Sun Oct 28 01:59:59 2018 UT = Sun Oct 28 02:59:59 2018 +01 isdst=1 gmtoff=3600
Africa/Casablanca  Sun Oct 28 02:00:00 2018 UT = Sun Oct 28 03:00:00 2018 +01 isdst=0 gmtoff=3600
---
then we could not determine isdst from the timezone (+01 in the above)
and mktime() will provide wrong results.

Fixes #26370.
src/basic/time-util.c