From f80f216625c199a9c77be0f6bac1df172f61b1fa Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Wed, 24 Jul 2013 17:28:18 +0200 Subject: [PATCH] mktime takes local time, not UTC GPG signature timestamps are considered UTC, this may cause times to be off by delta > 1000 in def test_signature_string_verification because it incorrectly gave gmtime() as an argument to mktime(). Python 2 and 3 docs both say that mktime should have a struct_time argument "which expresses the time in local time, not UTC". So the test is now using time.localtime() instead of time.gmtime() --- gnupg/test/test_gnupg.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gnupg/test/test_gnupg.py b/gnupg/test/test_gnupg.py index c014b3a..15e2eb7 100644 --- a/gnupg/test/test_gnupg.py +++ b/gnupg/test/test_gnupg.py @@ -28,7 +28,7 @@ from argparse import ArgumentParser from codecs import open as open from functools import wraps from glob import glob -from time import gmtime +from time import localtime from time import mktime import encodings @@ -645,7 +645,7 @@ class GPGTestCase(unittest.TestCase): message += '[hackers in popular culture] to push for more power' sig = self.gpg.sign(message, default_key=key.fingerprint, passphrase='bruceschneier') - now = mktime(gmtime()) + now = mktime(localtime()) self.assertTrue(sig, "Good passphrase should succeed") verified = self.gpg.verify(sig.data) self.assertIsNotNone(verified.fingerprint)