utils.py
changeset 129 67a30d680f60
parent 117 f0b4097f5781
--- a/utils.py	Sat Feb 14 20:13:26 2009 +0200
+++ b/utils.py	Sun Feb 15 23:50:24 2009 +0200
@@ -114,3 +114,24 @@
         # decode
         return from_utc_timestamp(st.st_mtime)
 
+class FixedOffsetTimezone (pytz._FixedOffset) :
+    """
+        A Fixed-offset timezone with no DST info, compatible with pytz.
+
+        This is based on pytz._FixedOffset, but overrides dst() to return timedelta(0)
+    """
+
+    def __init__ (self, minutes) :
+        """
+            Minutes is simply the offset from UTC in minutes, positive or negative, at most 24h.
+        """
+
+        pytz._FixedOffset.__init__(self, minutes)
+
+    def dst (self, dt) :
+        """
+            No DST info
+        """
+
+        return datetime.timedelta(0)
+