[OLPC-AU] Testing Summary: Auckland NZ - 19 March 2011
James Cameron
quozl at laptop.org
Mon Mar 21 04:50:56 EDT 2011
On Mon, Mar 21, 2011 at 08:24:25PM +1300, Tabitha Roder wrote:
> Power logs are attached. This release is in timezone "CST" which broke the
> power log workflow as timezones seem to be very difficult in python. How do I
> convert a string with a three letter timezone into seconds since the epoch? I
> still haven't shared this script but the relevant code is:
>
> # WTF this doesn't parse 'Sat Mar 19 09:20:45 CST 2011'
> # laptopTZDate = datetime.strptime(dateString[6:-1], "%a %b %d %H:%M:%S %Z
> %Y")
> # this only works for input in GMT
> laptopTZDate = time.strptime(dateString[6:-1], "%a %b %d %H:%M:%S %Z %Y")
> localTZDate = time.localtime(calendar.timegm(laptopTZDate))
The logging script needs a change that has already been applied to
panelpwr-log [1], which records both the UNIX epoch timestamp (%s) and
the "date -R" output, as a result the time would be better formatted for
processing.
In the meanwhile, set TZ to Australia/Darwin, strip the CST, and try
strptime again.
Or convert the time to "date -R" format?
References:
1.
http://dev.laptop.org/git/users/rsmith/olpc-pwrlogs/tree/panelpwr-log
--
James Cameron
http://quozl.linux.org.au/
More information about the OLPC-AU
mailing list