[olpc-nz] [Testing] [OLPC-AU] Testing Summary: Auckland NZ - 19 March 2011

Richard A. Smith richard at laptop.org
Tue Mar 22 21:49:20 EDT 2011

On 03/21/2011 08:26 AM, Paul Fox wrote:
> james wrote:
>   >  Looking at file pwr-CSN74804D7E-110319_092045.csv we see the first data
>   >  line is:
>   >
>   >  1300492245,52,6379990,-1155598,3053,6583214,Discharging,startup
>   >
>   >  ... and this is ...
>   >
>   >  $ TZ=Australia/Darwin date --date=@1300492245
>   >  Sat Mar 19 09:20:45 CST 2011
>   >
>   >  ... which matches the DATE: line ...
>   >
>   >  DATE: Sat Mar 19 09:20:45 CST 2011
> to complicate things further, the next release of powerd will change
> that DATE:  header to:
>      DATE: $(date "+%F %T %z")
> i.e., it will look like:
>      DATE: 2011-03-21 08:23:08 -0400
> the FORMAT: header will change from '2' to '3' at the same time.
> this change will make the date header language independent.


I'm sorry I broke you script.  I forgot that you were using the DATE: 
field.  I had to change the date format to due to date parsing in my 
program that processes the power logs.  In order to be able to sort the 
logs by date and do things like display the power vs time of day 
(important for logs from PV panels) I need to have my program grok the 
DATE: field and understand the timezone and as you have discovered its 
quite a task.  There are lots of issues to consider.

If you are trying to process dates in Python then you need 
python-dateutil.  For my Debian machine it was a simple apt-get away.


dateutil has a parser that will parse all of the date formats in all 
versions of the logs correctly if you set the fuzzy=True option when you 
call the parser so that it ignores unknown tokens.  I had Paul change it 
before I figured all that out.   I decided though that the DATE: format 
thats in the latest powerd is simpler and easier to parse from other 
stuff besides python so I didn't change it back.

It should not need to change since the current format contains all the 
necessary date info available.

Richard A. Smith  <richard at laptop.org>
One Laptop per Child

More information about the olpc-nz mailing list