sanPerl has asked for the wisdom of the Perl Monks concerning the following question:
I am writing perl scripts for nagios. I am getting a value $time_new from a subroutine. I am using
to get the number of seconds from epoch (for e.g. date -d 'Tue Feb 13 19:04:04 IST 2007' +%s, gives you 1171373644). It is running fine on Linux, when I run my script on SunOS Unix, the script fails.
I checked with man pages of SunOS and found that there is NO +%s option in Unix date command.
Any suggestions please
$time = `date -d '$time_new' '+%s'`;
to get the number of seconds from epoch (for e.g. date -d 'Tue Feb 13 19:04:04 IST 2007' +%s, gives you 1171373644). It is running fine on Linux, when I run my script on SunOS Unix, the script fails.
I checked with man pages of SunOS and found that there is NO +%s option in Unix date command.
Any suggestions please
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: [OT] Number of seconds from epoch
by Corion (Patriarch) on Feb 13, 2007 at 13:41 UTC | |
by fmerges (Chaplain) on Feb 13, 2007 at 14:13 UTC | |
Re: [OT] Number of seconds from epoch
by almut (Canon) on Feb 13, 2007 at 14:17 UTC | |
by sanPerl (Friar) on Feb 13, 2007 at 15:43 UTC | |
Re: [OT] Number of seconds from epoch
by klekker (Pilgrim) on Feb 13, 2007 at 13:57 UTC | |
by davorg (Chancellor) on Feb 13, 2007 at 14:02 UTC |
Back to
Seekers of Perl Wisdom