notmyname/slogging — Issue #24: slogging time bug
Author: shineyear
Created: 2011-12-11 22:38:38+00:00
State: open

i m in australia and my computer have to times:

localtime and UTC time

in slogging and swift code, all use gmtime to get the UTC time

but my localtime is different

so when i run swift stats collector program to calculate all the swift proxy log and account/container stats, i found that:

proxy log use UTC time , and account/container stats use localtime!!

so i change the access_processor.py like that:

day, month, year, hour, minute, second = timestamp.split('/')
month = ('%02s' % month_map.index(month)).replace(' ', '0')

timestr = day+"/"+month+"/"+year+"/"+hour+"/"+minute+"/"+second
timestr2 = "01/01/1970/00/0/0"

timestr = time.mktime(time.strptime(timestr, "%d/%m/%Y/%H/%M/%S"))
timestr2 = time.mktime(time.strptime(timestr2, "%d/%m/%Y/%H/%M/%S"))

timestr = time.localtime(timestr - timestr2 + 3600)

timestamp = time.strftime("%d/%m/%Y/%H/%M/%S", timestr)
day, month, year, hour, minute, second = timestamp.split('/')

that can change the proxy log time to localtime , so that can make sure the calculate result is correct!