diff options
Diffstat (limited to 'src/isodate/tzinfo.py')
-rw-r--r-- | src/isodate/tzinfo.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/isodate/tzinfo.py b/src/isodate/tzinfo.py index b41f058..5d3a42d 100644 --- a/src/isodate/tzinfo.py +++ b/src/isodate/tzinfo.py @@ -36,10 +36,24 @@ class Utc(tzinfo): ''' return ZERO + def __reduce__(self): + ''' + When unpickling a Utc object, return the default instance below, UTC. + ''' + return _Utc, () + + UTC = Utc() # the default instance for UTC. +def _Utc(): + ''' + Helper function for unpickling a Utc object. + ''' + return UTC + + class FixedOffset(tzinfo): ''' A class building tzinfo objects for fixed-offset time zones. @@ -138,5 +152,6 @@ class LocalTimezone(tzinfo): tt = time.localtime(stamp) return tt.tm_isdst > 0 -LOCAL = LocalTimezone() + # the default instance for local time zone. +LOCAL = LocalTimezone() |