[rrd-users] Timestamp problem

Mats Gustafsson gentoo at mats-gustafsson.se
Mon Feb 23 16:45:04 CET 2009


> And that's most likely the case.
> 
> Why are you so sure that it is 01:50pm ?
> 
> Check your computer's time. It doesn't matter what the clock on the wall 
> shows,  "date +%s" or similar is what counts.
> 
> This example from my site: http://www.vandenbogaerdt.nl/rrdtool/timezone.php
> 
> perl -e 'print gmtime(time)."\n".localtime(time)."\n"'
> 
> it should show UTC time and local time. You are on european time, so there 
> should be one hour difference in it, no more no less.
> 
> I ran it at 16:12:18 my time (also european time):
> 
> $ perl -e 'print gmtime(time)."\n".localtime(time)."\n"'
> Mon Feb 23 15:12:18 2009
> Mon Feb 23 16:12:18 2009
> 
> HTH
> Alex

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







More information about the rrd-users mailing list