cleaning up timezone handling a bit

This commit is contained in:
Ryan Tucker 2010-01-04 16:09:08 -05:00
parent 1b1ad9445e
commit 8b3283aeb8

View file

@ -241,7 +241,7 @@ def main():
datestruct = backups[backupnum]['date'] datestruct = backups[backupnum]['date']
inprogress = '*' inprogress = '*'
timestamp = time.mktime(datestruct) timestamp = time.mktime(datestruct)
delta = int(time.time() - timestamp) delta = int(time.time() - timestamp + time.timezone)
if delta < 3600: if delta < 3600:
prettydelta = '%i min ago' % (delta/60) prettydelta = '%i min ago' % (delta/60)
elif delta < 86400: elif delta < 86400:
@ -270,7 +270,7 @@ def main():
else: else:
datestruct = backups[backupnum]['date'] datestruct = backups[backupnum]['date']
timestamp = time.mktime(datestruct) timestamp = time.mktime(datestruct)
delta = int(time.time() - timestamp) delta = int(time.time() - timestamp + time.timezone)
if delta > maxage: if delta > maxage:
if options.unfinalized and backups[backupnum]['finalized'] > 0: if options.unfinalized and backups[backupnum]['finalized'] > 0:
sys.stdout.write('Bypassing finalized backup %s #%i (%i files, age %.2f days)\n' % (hostname, backupnum, filecount, delta/86400.0)) sys.stdout.write('Bypassing finalized backup %s #%i (%i files, age %.2f days)\n' % (hostname, backupnum, filecount, delta/86400.0))
@ -298,7 +298,7 @@ def main():
datestruct = toast['date'] datestruct = toast['date']
timestamp = time.mktime(datestruct) timestamp = time.mktime(datestruct)
delta = int(time.time() - timestamp) delta = int(time.time() - timestamp + time.timezone)
if options.unfinalized and toast['finalized'] > 0: if options.unfinalized and toast['finalized'] > 0:
sys.stdout.write('Bypassing finalized backup %s #%i (%i files, age %.2f days)\n' % (hostname, backupnum, filecount, delta/86400.0)) sys.stdout.write('Bypassing finalized backup %s #%i (%i files, age %.2f days)\n' % (hostname, backupnum, filecount, delta/86400.0))