/usr/lib64/python2.6/site-packages/mx/DateTime
NameSizeModeActions
mxDateTime/-0755rm
ARPA.py76160644editdlrm
ARPA.pyc74800644editdlrm
ARPA.pyo74800644editdlrm
COPYRIGHT10300644editdlrm
DateTime.py321190644editdlrm
DateTime.pyc273180644editdlrm
DateTime.pyo272170644editdlrm
Feasts.py28560644editdlrm
Feasts.pyc46590644editdlrm
Feasts.pyo46590644editdlrm
ISO.py104410644editdlrm
ISO.pyc103810644editdlrm
ISO.pyo103810644editdlrm
LazyModule.py44000644editdlrm
LazyModule.pyc42720644editdlrm
LazyModule.pyo42720644editdlrm
LICENSE45870644editdlrm
Locale.py45840644editdlrm
Locale.pyc58500644editdlrm
Locale.pyo58500644editdlrm
NIST.py145840644editdlrm
NIST.pyc135790644editdlrm
NIST.pyo135790644editdlrm
ODMG.py52620644editdlrm
ODMG.pyc76600644editdlrm
ODMG.pyo76600644editdlrm
Parser.py425430644editdlrm
Parser.pyc364050644editdlrm
Parser.pyo364050644editdlrm
README1420644editdlrm
timegm.py28330644editdlrm
timegm.pyc30950644editdlrm
timegm.pyo30950644editdlrm
Timezone.py50960644editdlrm
Timezone.pyc36520644editdlrm
Timezone.pyo36520644editdlrm
__init__.py17080644editdlrm
__init__.pyc21800644editdlrm
__init__.pyo21800644editdlrm
Edit: /usr/lib64/python2.6/site-packages/mx/DateTime/timegm.py (2833B)
""" A timegm() emulation for platforms that do not provide the C lib API. This is the prototype I used to code the timegm() C emulation in mxDateTime. It offers a little more than is really needed... Copyright (c) 2000, Marc-Andre Lemburg; mailto:mal@lemburg.com Copyright (c) 2000-2008, eGenix.com Software GmbH; mailto:info@egenix.com See the documentation for further information on copyrights, or contact the author. All Rights Reserved. """ from time import * _debug = 0 def local_offset(ticks): if _debug: print 'local:',localtime(ticks) print 'GMT:',gmtime(ticks) (localyear,localmonth,localday, localhour,localminute,localsecond, localwday,localyday,localdst) = localtime(ticks) (gmyear,gmmonth,gmday, gmhour,gmminute,gmsecond, gmwday,gmyday,gmdst) = gmtime(ticks) if gmday != localday: localdate = localyear * 10000 + localmonth * 100 + localday gmdate = gmyear * 10000 + gmmonth * 100 + gmday if localdate < gmdate: offset = -86400 else: offset = 86400 else: offset = 0 return (offset + (localhour - gmhour) * 3600 + (localminute - gmminute) * 60 + (localsecond - gmsecond)) def timegm(year,month,day,hour,minute,second,wday,yday,dst): try: ticks = mktime(year,month,day,hour,minute,second,wday,yday,-1) return ticks + local_offset(ticks) except OverflowError: # Hmm, we may have stumbled into the "missing" hour during a # DST switch... ticks = mktime(year,month,day,0,0,0,wday,yday,-1) offset = local_offset(ticks) return (ticks + offset + 3600 * hour + 60 * minute + second) def dst(ticks): offset = local_offset(ticks) for checkpoint in (-8640000,10000000,-20560000,20560000): try: reference = local_offset(ticks + checkpoint) except OverflowError: continue if reference != offset: break if _debug: print 'given:',offset,'reference:',reference,'(checkpoint:',checkpoint,')' return offset > reference def _test(): t = 920710000 oops = 0 while 1: x = apply(timegm,gmtime(t)) if x != t: print 'Ooops:',gmtime(t),'t =',t,'diff =',x-t oops = oops + 1 isdst = localtime(t)[-1] if isdst != -1 and isdst != dst(t): print 'Ooops: t =',t,'dst() =',dst(t),'isdst =',isdst oops = oops + 1 try: t = t + 10011 except OverflowError: break if not oops: print 'Works.' return 1 else: print 'Got %i warnings.' % oops return 0 if __name__ == '__main__': _test()