[rrd-users] Timestamp problem

Alex van den Bogaerdt alex at vandenbogaerdt.nl
Mon Feb 23 18:07:47 CET 2009

----- Original Message ----- 
From: "Mats Gustafsson" <gentoo at mats-gustafsson.se>
To: <rrd-users at lists.oetiker.ch>
Cc: "Mats Gustafsson" <gentoo at mats-gustafsson.se>
Sent: Monday, February 23, 2009 4:45 PM
Subject: Re: [rrd-users] Timestamp problem

> Thanks for your suggestions Alex.
> I ran the command at 01:50pm that is why I expected the timestamp to
> show that time.
> So, if I now run the below sequence my problem maybe becomes clearer:
> $ perl -e 'print gmtime(time)."\n".localtime(time)."\n"'
> Mon Feb 23 15:40:28 2009
> Mon Feb 23 16:40:28 2009
> $ rrdtool update /home/mats/mirror/weather_db/measure2.rrd N:0:0:U:U:U:U
> $ perl -e 'print gmtime(time)."\n".localtime(time)."\n"'
> Mon Feb 23 15:40:37 2009
> Mon Feb 23 16:40:37 2009
> $ rrdtool last ~/mirror/weather_db/measure2.rrd
> 1235403634
> Looking into this page:
> http://www.glassgiant.com/geek/unix-timestamp/?timestamp=1235403153&subts=Convert&datestring=2009%2F02%2F23+01%3A45%3A00+pm
> I translate the time stamp 1235403634 to 2009/02/23 07:40:34 am PST,
> which is not what I expected. I would have expected something like 16:40
> which is what your perl script shows.
> So, that is why I wonder what N translates into on my system.
> /Mats

Now I notice 'PST'.  That's somewhere in the USA. It's just another 
timezone.  I missed this the first time, probably because apart from a whole 
number of hours, there was also a 5 minute difference.

Sure, if it's 16:40 over here in europe, it's 07:40am in one of the USA 
timezones. That's no surprise.

Try this:

$ unixtime 1235403634

that means its done at 15:40:34 internally, which translates to 16:40:34 
your local time.

'unixtime' is a bash function I've written:

unixtime ()
    /bin/date -ud 1970-01-01\ 00:00\ +0000\ +${1}sec +%Y-%m-%dT%H:%M:%SZ

(if someone knows a better function: please do share!)

We now know:

a: "N" is working as expected
b: you should read the information on the page I sent you the link for
c: I should pay more attention to 'PST' next time. Sorry

More information about the rrd-users mailing list