summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2022-03-26 10:13:24 +0000
committerLars Wirzenius <liw@liw.fi>2022-03-26 10:13:24 +0000
commit48d29188dcb9ded11bb373891233ac675b322d54 (patch)
tree9332c87c5e907a5fd40b8cfb520b64a7d94abe33
parentfab67b9481a8df42656b1bb0777d818bb350bd17 (diff)
parent10b74c4f212a45ce2bbf2f5c0760ad034e40e873 (diff)
downloadsubplot-48d29188dcb9ded11bb373891233ac675b322d54.tar.gz
Merge branch 'fix-265' into 'main'
Ensure tests pass with unusual timezones Closes #265 See merge request subplot/subplot!263
-rwxr-xr-xcheck4
-rw-r--r--share/python/lib/files.py6
2 files changed, 6 insertions, 4 deletions
diff --git a/check b/check
index 4db9f92..2920d24 100755
--- a/check
+++ b/check
@@ -16,7 +16,9 @@ class Runcmd:
def __init__(self, verbose, progress):
self._verbose = verbose
self._progress = progress
- self._env = {"TZ": "UTC"}
+ # Deliberately chosen because it's 12:45 / 13:45 offset from UTC
+ # As such it ought to show any TZ related errors if we're lucky.
+ self._env = {"TZ": "NZ-CHAT"}
def _write_msg(self, msg):
sys.stdout.write(f"{msg}\n")
diff --git a/share/python/lib/files.py b/share/python/lib/files.py
index 3ea5877..8bc512a 100644
--- a/share/python/lib/files.py
+++ b/share/python/lib/files.py
@@ -1,4 +1,4 @@
-from time import strptime
+from datetime import datetime
import logging
import os
@@ -117,8 +117,8 @@ def files_match(ctx, filename1=None, filename2=None):
def files_touch_with_timestamp(ctx, filename=None, mtime=None):
- t = strptime(mtime, "%Y-%m-%d %H:%M:%S")
- ts = time.mktime(t)
+ t = datetime.strptime(mtime + " +0000", "%Y-%m-%d %H:%M:%S %z")
+ ts = t.timestamp()
_files_touch(filename, ts)