[Nagiosplug-devel] semantics of macro $SERVICECHECKTIME$

Thomas Guyot-Sionnest dermoth at aei.ca
Tue Apr 29 13:31:04 CEST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 29/04/08 06:27 AM, Andreas Ericsson wrote:
> jimmy.mathew1 at wipro.com wrote:
>> hi all
>>
>> can any one tell the semantics of data(time information) stored in macro $SERVICECHECKTIME$
>>
>> Actually it stores time information in 10 digits ( eg:1209449397)
>>
>> I wanted to convert this information into time-date format ( dd:mm:yyyy-seconds:minute:hour)
>>
> 
> Google for "timestamp" "unix epoch"
> 

You can use:

$ date -d @1209449397

"man date" for the output format string (which will allow printing in
the format you want)

Or in Perl:

$ perl -e 'print scalar(localtime(1209449397)) . "\n";'

"perldoc -f localtime" for examples on how to use localtime to print the
date in the format you want.

Many other programming languages have their own functions to convert
epoch time to local time.

Thomas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIFwb46dZ+Kt5BchYRAuGAAJ0RDtjG73Ev4MxsoIik0M14GgmXXQCfX24Q
xJ8YhukzTyvkuV5f7BOuLhg=
=ylQT
-----END PGP SIGNATURE-----




More information about the Devel mailing list