diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2023-03-26 18:40:31 +0200 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2023-03-26 18:55:58 +0200 |
commit | 92dfc055ce7a24bc8120c7eece3caca0ae84b653 (patch) | |
tree | ae7a8b4eed755d77461714d9d20a1747d372931f /sfeed_frames.c | |
parent | c7739b9c04b4b49888e1161164b1cdac0d9930ca (diff) |
sfeed.c: parsetime improve parsing RFC2822 obsolete short year
https://datatracker.ietf.org/doc/html/rfc2822#section-4.3
"Where a two or three digit year occurs in a date, the year is to be
interpreted as follows: If a two digit year is encountered whose
value is between 00 and 49, the year is interpreted by adding 2000,
ending up with a value between 2000 and 2049. If a two digit year is
encountered with a value between 50 and 99, or any three digit year
is encountered, the year is interpreted by adding 1900."
Improvement on commit 7086670e4335714e1df982bf1058082b7400b653
For example (output from TZ=UTC sfeed_plain):
input: Sun, 26 Jul 049 19:26:34
was: 2049-07-26 19:26
now: 1949-07-26 19:26 (because this is a 3-digit year)
input: Sun, 26 Jul 1 19:26:34
was: 2001-07-26 19:26
now: 0001-07-26 19:26 (because this is a 1-digit year and doesn't match the short year rule)
input: Sun, 26 Jul 001 19:26:34
was: 2001-07-26 19:26
now: 1901-07-26 19:26 (because this is a 3 digit year)
These cases are all added to the tests in the sfeed_tests repo (times.xml file).
Diffstat (limited to 'sfeed_frames.c')
0 files changed, 0 insertions, 0 deletions