[rrd-users] RRDTool time format

Sam Umbach sumbach at gmail.com
Wed Aug 15 07:26:31 CEST 2007


The constructor for the Timestamp class requires a value in
milliseconds since epoch (1 Jan 1970).  RRDTool requires "UNIX time"
which is seconds since epoch.  If you need to convert from RRD time to
java time, just multiply by 1000.  Similarly, you should divide by
1000 (or just drop the last three digits) when going to other way.

-Sam

On 8/5/07, musto <must_top at yahoo.com> wrote:
>
> Hello everyone :)
>
> I'm having problems in creating a timestamp with a given long value. I got
> the long value by using  a simple rrdtool command, which is "rrdtool info
> <table_name>.rrd" and I look for the row that showsl "last_update  =
> 1186372065"   and
> get the number. I'm pretty sure it is correct (Am I not ?).
>
> this is the code that I wrote :
>
> import  java.sql.Timestamp;
>
> ...
> System.out.println(new Timestamp (1186364206).toString());
> ...
>
> the output :
>
>
> 1970-01-15 01:02:44.206
>
> It seems to be wrong, since the table was updated about one minute earlier
> before I wrote the code. The weird thing is, when I typed
>
> System.out.println(System.currentTimeMillis().getTime());
>
> the output :
>
> 1186370094158 <== this long value is much longer than the one I got from the
> database (1186364206) and I wonder why
>
>
> * I'm using a real-time database (done with RRDTool) that stores values
> every 15 seconds. In order to get the last inserted value all I got to do is
> typing this command (rrdtool info <table_name>.rrd) and the long value will
> show up.
>
> I hope I don't create too much confusion here among the readers. Any help
> will be greatly appreciated.
>
> Regards,
>
> Mustofa
>
> --
> View this message in context: http://www.nabble.com/RRDTool-time-format-tf4222124.html#a12010745
> Sent from the RRDTool - User mailing list archive at Nabble.com.
>
> _______________________________________________
> rrd-users mailing list
> rrd-users at lists.oetiker.ch
> https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
>



More information about the rrd-users mailing list