Hi John,
Here's a little function that I use for putting a time stamp on web
pages. Maybe that will help.
Regards,
Vic
At 8:15 AM -0400 7/12/02, John A. Conrad wrote:
>What is the code for MacPerl to get the system date and time
>on a Mac box running OS8.x?
>Can MacPerl obtain the date/time through the webserver's
>SSI? (Webstar 4.2)?
>
>John Conrad
------------ timestamp script follows ---------------------
#!perl -w
# timestamp.pl - construct a current date-time string
use strict;
my $mystamp = timestamp();
print "$mystamp\n";
sub timestamp { # generate the current date-time string
# form: Wed, 17 Jan 2001 05:13:13 -0500
# get time
my ($sec, $min, $hour, $mday, $mon, $dyear, $wday) = localtime;
my $sday = (qw(Sun Mon Tue Wed Thu Fri Sat))[$wday];
my $smon = (qw(Jan Feb Mar Apr May Jun
Jul Aug Sep Oct Nov Dec))[$mon];
my $year = 1900 + $dyear;
# get time zone
use Time::Local;
my $zhour = timegm($sec, $min, $hour, $mday, $mon, $dyear)
- timelocal($sec, $min, $hour, $mday, $mon, $dyear);
$zhour /= 60;
my $zmin = $zhour % 60;
if ($zhour * $zmin < 0) { $zmin -= 60 }
$zhour = ($zhour - $zmin)/60;
$zmin = abs($zmin);
# return timestamp
return sprintf "%s, %u %s %u %02u:%02u:%02u %+03d%02u",
$sday, $mday, $smon, $year, $hour, $min, $sec, $zhour, $zmin;
}
--
*---* mailto:[EMAIL PROTECTED]
| Victor Thane Norton, Jr.
| Mathematician and Motorcyclist
| phone: 419-353-3399
*---* http://vic.norton.name