Nagios 1.2 - qpage
rader at ginseng.hep.wisc.edu
rader at ginseng.hep.wisc.edu
Fri Nov 12 22:58:13 CET 2004
> Steve> curious...
>
> Steve> % date -r 1100295211 +%H:%M
> Steve> date: 1100295211: No such file or directory
>
> Steve> what flavor of "date" are you using??
>
> The FreeBSD flavor. (Ummm! Tasty!)
>
> You need to get your date to convert that UNIX timestamp to a human
> friendly string. (Putting aside the group of humans that grok those
> timestamps with out conversion.)
>
> I've never figured out how to persuade the GNU date to handle UNIX
> timestamps. Its a trivial C or Perl program to do this for you. But a
> little research into GNU's date will probably get it done too.
this is the best i can think of...
steve
- - -
#!/usr/bin/perl -w
#
# stamp2date: convert time_t time stamp into date string
# using GNU date
#
use strict;
if ( $#ARGV < 0 || $#ARGV > 1 ) {
print STDERR "usage: stamp2date timestamp [+DATE_FORMAT]\n";
exit 1;
}
my $stamp = shift @ARGV;
my $date_string = '"' . scalar localtime($stamp) . '"';
my $date_spec = '';
if ( $ARGV[0] ) { $date_spec = '"' . $ARGV[0] . '"'; }
print `/bin/date -d $date_string $date_spec`;
-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Users
mailing list