moul :: time :: cavern :: CavernTime :: Class CavernTime
[hide private]
[frames] | no frames]

Class CavernTime



object --+
         |
        CavernTime

Cavern time calculator

Calculates the cavern time and other useful tz based on a given local time zone. Call a CavernTime object:

utc cavern, pacific
>>> ct = CavernTime()
>>> result = ct()
>>> 'cavern' in result, 'pacific' in result
(True, True)
>>> result = ct.info()
>>> 'utc' in result
True
>>> cav = result['cavern']
>>> off = cav['utcoffset']
>>> dst = cav['dst']
>>> (not dst and off == ('-', -7, 0.0)) or (dst and off == ('-', -8, 0.0)) or off
True
>>> cav['id']
'MST'
>>> cav['name']
'US/Mountain'
>>> cav['dst'] in (0, 3600)
True
>>> del cav
>>> pst = result['pacific']
>>> dst = pst['dst']
>>> (not dst and off == ('-', -7, 0.0)) or (dst and off == ('-', -8, 0.0)) or off
True
>>> pst['id']
'PST'
>>> pst['name']
'US/Pacific'
>>> pst['dst'] in (0, 3600)
True
>>> del pst
#>>> 'UTC' in CavernTime.timezones #True #>>> 'UTC' in ct.timezones #True

Instance Methods [hide private]
  __call__(self)
  info(self)
  __str__(self)
str(x)

Inherited from object: __delattr__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__


Static Methods [hide private]
  _utcnow()
Get current time in UTC
  _normalize(tz, utc_dt=None)
Normalize a datetime object with UTC tz using another tz

Class Variables [hide private]
  _cavern = <DstTzInfo 'US/Mountain' MST-1 day, 17:00:00 STD>
  _cavern_name = ('US/Mountain', 'MST', 'MDT')
  _pacific = <DstTzInfo 'US/Pacific' PST-1 day, 16:00:00 STD>
  _pacific_name = ('US/Pacific', 'PST', 'PDT')

Properties [hide private]

Inherited from object: __class__


Method Details [hide private]

_utcnow()
Static Method

 
Get current time in UTC
Decorators:

_normalize(tz, utc_dt=None)
Static Method

 
Normalize a datetime object with UTC tz using another tz
Decorators:

__call__(self)
(Call operator)

 
None

info(self)

 
None

__str__(self)
(Informal representation operator)

 
str(x)
Overrides: object.__str__
(inherited documentation)

Class Variable Details [hide private]

_cavern

None
Value:
<DstTzInfo 'US/Mountain' MST-1 day, 17:00:00 STD>                      
      

_cavern_name

None
Value:
('US/Mountain', 'MST', 'MDT')                                          
      

_pacific

None
Value:
<DstTzInfo 'US/Pacific' PST-1 day, 16:00:00 STD>                       
      

_pacific_name

None
Value:
('US/Pacific', 'PST', 'PDT')