bpo-43869: Time Epoch is the same on all platforms (GH-30664)

This commit is contained in:
Victor Stinner 2022-01-19 11:27:11 +01:00 committed by GitHub
parent 7c0914d35e
commit a847785b40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 17 deletions

View file

@ -159,6 +159,13 @@ class TimeTestCase(unittest.TestCase):
self.assertRaises(ValueError, time.sleep, -1)
time.sleep(1.2)
def test_epoch(self):
# bpo-43869: Make sure that Python use the same Epoch on all platforms:
# January 1, 1970, 00:00:00 (UTC).
epoch = time.gmtime(0)
# Only test the date and time, ignore other gmtime() members
self.assertEqual(tuple(epoch)[:6], (1970, 1, 1, 0, 0, 0), epoch)
def test_strftime(self):
tt = time.gmtime(self.t)
for directive in ('a', 'A', 'b', 'B', 'c', 'd', 'H', 'I',