comparison mercurial/util.py @ 1482:4d38b85e60aa

fix handling of daylight saving time
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Mon, 31 Oct 2005 10:56:42 -0700
parents 1a3c6689ef2b
children 11a58d2cdffb 32a4e6802864
comparison
equal deleted inserted replaced
1481:acd1832ebf31 1482:4d38b85e60aa
608 while len(s) > 0: 608 while len(s) > 0:
609 yield s 609 yield s
610 s = f.read(size) 610 s = f.read(size)
611 611
612 def makedate(): 612 def makedate():
613 t = time.time() 613 lt = time.localtime()
614 if time.daylight: tz = time.altzone 614 if lt[8] == 1 and time.daylight:
615 else: tz = time.timezone 615 tz = time.altzone
616 return t, tz 616 else:
617 tz = time.timezone
618 return time.mktime(lt), tz
617 619
618 def datestr(date=None, format='%c'): 620 def datestr(date=None, format='%c'):
619 """represent a (unixtime, offset) tuple as a localized time. 621 """represent a (unixtime, offset) tuple as a localized time.
620 unixtime is seconds since the epoch, and offset is the time zone's 622 unixtime is seconds since the epoch, and offset is the time zone's
621 number of seconds away from UTC.""" 623 number of seconds away from UTC."""