*** From dhcp-server -- To unsubscribe, see the end of this message. ***
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of Robert Elz
> Sent: Thursday, April 22, 1999 8:38 AM
> To: Roderick B. Greening
> Cc: Ted Lemon; [EMAIL PROTECTED]
> Subject: Re: wrong time in dhcpd.leases file
>
>
> *** From dhcp-server -- To unsubscribe, see the end of this
> message. ***
>
> Date: Thu, 22 Apr 1999 09:10:19 -0230 (NDT)
> From: "Roderick B. Greening" <[EMAIL PROTECTED]>
> Message-ID:
> <[EMAIL PROTECTED]>
>
> | How hard would it be to implement a flag for setting the time offset?
>
> Easy, I imagine, but simply wrong. If you want to view the leases in
> local time, write a little report generator that does that (the format
> could then be as sexy as you like, sorted however you like, ...)
Here's one in perl. Save the following to a file (leaseview), make the file
executable
(chmod +x leaseview). Run it: (leaseview dhcpd.lease)
#!/usr/local/bin/perl
# Converts dhcpd.lease to show local time
use English;
use Time::localtime;
use Time::Local; # for timegm()
print "Usage: $PROGRAM_NAME dhcpd.lease\n" if ($#ARGV < 0);
$file = shift(@ARGV);
open(IN,"<$file") || die "Can't open input file \"$file\" $!";
while (<IN>) {
if (/^(\s+(starts|ends)\s+\d+\s+)([^;]+)/) {
my $beforeTimeStr=$1;
my $gmtStr = $3;
print $beforeTimeStr,convertToLocalTime($gmtStr),$POSTMATCH;
} else {
print;
}
}
sub convertToLocalTime {
my($gmtStr) = shift(@_); # time in GMT in fmt YYYY/MM/DD HH:MM:SS
($Y,$M,$D,$h,$m,$s) = split(/[ :\/]/,$gmtStr);
my $localtime = ctime(timegm($s,$m,$h,$D, $M-1, $Y-1900));
return "$gmtStr GMT, $localtime local";
}
------------------------------------------------------------------------------
To unsubscribe from this list, please visit http://www.fugue.com/dhcp/lists
If you are without web access, or if you are having trouble with the web page,
please send mail to [EMAIL PROTECTED] Please try to use the web
page first - it will take a long time for your request to be processed by hand.
Archives for this mailing list are available at
http://www.webnology.com/list-archives/dhcp/dhcp-server
------------------------------------------------------------------------------