]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
util: oops, time.tzset() doesn't work on Windows -- hopefully the new "London" unit...
authorZooko O'Whielacronx <zooko@zooko.com>
Fri, 12 Jun 2009 00:09:20 +0000 (17:09 -0700)
committerZooko O'Whielacronx <zooko@zooko.com>
Fri, 12 Jun 2009 00:09:20 +0000 (17:09 -0700)
src/allmydata/test/test_util.py
src/allmydata/util/time_format.py

index 0f0fbba9a6b1abd76ff0ac6a718807b194b954bb..adb9bca4152521ca3559c8161b07b544dd366261 100644 (file)
@@ -779,7 +779,8 @@ class TimeFormat(unittest.TestCase):
         # that implementation to something that works even in this case...)
         origtz = os.environ.get('TZ')
         os.environ['TZ'] = "Europe/London"
-        time.tzset()
+        if hasattr(time, 'tzset'):
+            time.tzset()
         try:
             return self._help_test_epoch()
         finally:
@@ -787,7 +788,8 @@ class TimeFormat(unittest.TestCase):
                 del os.environ['TZ']
             else:
                 os.environ['TZ'] = origtz
-            time.tzset()
+            if hasattr(time, 'tzset'):
+                time.tzset()
 
     def _help_test_epoch(self):
         s = time_format.iso_utc_time_to_seconds("1970-01-01T00:00:01")
index aa0b64d8b269974f27d33c135e6b66b1f9f28703..42e6aee086c9eaad1a99a36f3cc03a3a330c769d 100644 (file)
@@ -44,7 +44,8 @@ def iso_utc_time_to_seconds(isotime, _conversion_re=re.compile(r"(?P<year>\d{4})
 
     origtz = os.environ.get('TZ')
     os.environ['TZ'] = "UTC"
-    time.tzset()
+    if hasattr(time, 'tzset'):
+        time.tzset()
     try:
         return time.mktime( (year, month, day, hour, minute, second, 0, 1, 0) ) + subsecfloat
     finally:
@@ -52,7 +53,8 @@ def iso_utc_time_to_seconds(isotime, _conversion_re=re.compile(r"(?P<year>\d{4})
             del os.environ['TZ']
         else:
             os.environ['TZ'] = origtz
-        time.tzset()
+        if hasattr(time, 'tzset'):
+            time.tzset()
 
 def parse_duration(s):
     orig = s