def unix_epoch():
 global _unix_epoch
 if (_unix_epoch >= 0):
  return _unix_epoch
 import time
 now = time.time()
 localt = time.localtime(now)
 gmt = time.gmtime(now)
 offset = (time.mktime(localt) - time.mktime(gmt))
 (y, m, d, hh, mm, ss) = (1970, 1, 1, 0, 0, 0)
 (offset, ss) = divmod((ss + offset), 60)
 (offset, mm) = divmod((mm + offset), 60)
 (offset, hh) = divmod((hh + offset), 24)
 d = (d + offset)
 _unix_epoch = time.mktime((y, m, d, hh, mm, ss, 0, 0, 0))
 print 'Unix epoch:', time.ctime(_unix_epoch)
 return _unix_epoch

def unix_epoch ( ) : global _unix_epoch if ( _unix_epoch >= 0 ) : return _unix_epoch import time now = time . time ( ) localt = time . localtime ( now ) gmt = time . gmtime ( now ) offset = ( time . mktime ( localt ) - time . mktime ( gmt ) ) ( y , m , d , hh , mm , ss ) = ( 1970 , 1 , 1 , 0 , 0 , 0 ) ( offset , ss ) = divmod ( ( ss + offset ) , 60 ) ( offset , mm ) = divmod ( ( mm + offset ) , 60 ) ( offset , hh ) = divmod ( ( hh + offset ) , 24 ) d = ( d + offset ) _unix_epoch = time . mktime ( ( y , m , d , hh , mm , ss , 0 , 0 , 0 ) ) print 'Unix epoch:' , time . ctime ( _unix_epoch ) return _unix_epoch
very painful calculation of when the unix epoch is .