diff options
author | stijn <stijn@ignitron.net> | 2020-01-07 01:36:09 +1400 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2020-01-06 23:28:42 +1100 |
commit | 54a2584de10103ba3e559de1034cc76962ec681e (patch) | |
tree | 6718bd2c236e5743add38fa72b28b13d519508d3 | |
parent | 4d528bbaa836b3d6ec0218ca7f7c92e1bf73704c (diff) |
tests/unix: Make unix time test pass on more platforms.
As the mktime documentation for CPython states: "The earliest date for
which it can generate a time is platform-dependent". In particular on
Windows this depends on the timezone so e.g. for UTC+2 the earliest is 2
hours past midnight January 1970. So change the reference to the earliest
possible, for UTC+14.
-rw-r--r-- | tests/unix/time.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/unix/time.py b/tests/unix/time.py index a96c3f5b6..35eddbe09 100644 --- a/tests/unix/time.py +++ b/tests/unix/time.py @@ -5,7 +5,7 @@ except ImportError: DAYS_PER_MONTH = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] -tzseconds = -time.mktime((1970, 1, 1, 0, 0, 0, 0, 0, 0)) +tzseconds = -time.mktime((1970, 1, 1, 14, 0, 0, 0, 0, 0)) def is_leap(year): return (year % 4) == 0 @@ -22,7 +22,7 @@ def test(): else: DAYS_PER_MONTH[2] = 28 for day in range(1, DAYS_PER_MONTH[month] + 1): - secs = time.mktime((year, month, day, 0, 0, 0, 0, 0, 0)) + tzseconds + secs = time.mktime((year, month, day, 14, 0, 0, 0, 0, 0)) + tzseconds if secs != seconds: print("mktime failed for %d-%02d-%02d got %d expected %d" % (year, month, day, secs, seconds)) return |