]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/test/test-date.c
time-util: make parse_timestamp() set 0 if the input is very old date (#6297)
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 8 Jul 2017 19:59:07 +0000 (04:59 +0900)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 8 Jul 2017 19:59:07 +0000 (15:59 -0400)
commit7635ab8e74ea4a94e81143c3077570a986df375c
tree0df63dcf3e39436aeb579bfad21ccb3f6d27ba66
parentb1aa5ced45951ed470188b362c61827fb31da2ab
time-util: make parse_timestamp() set 0 if the input is very old date (#6297)

If the input is older than "1970-01-01 UTC", then `parse_timestamp()`
fails and returns -EINVAL. However, if the input is e.g. `-100years`,
then the function succeeds and sets `usec = 0`.
This commit makes the function also succeed for old dates and set
`usec = 0`.

Fixes #6290.
src/basic/time-util.c
src/test/test-date.c