Bill-
UTC (Universal Time Code) means something like what you get from
localtime(), but with a " -0500" or " +0500" following
anything UTC for us east coast would be:
my $utcUSEASTtime = localtime()." +0500"; # assumes it is run in the us
east coast
for Israel (i believe 8 hours ahead of us east coast. it might be 7)
my $utcISRAELtime = localtime(). " +0300; # assumes it is run in Israel
UTC simply means you have a + or - in \d\d\d\d where the first two are
hours and the second two minutes format in relation to GMT (UTC +0000);
Manish-
i would suggest converting to epoch, normalizing on GMT and then comparing
sub time_diff{
# get two args in UTC format
my $first_utc=$_[0];
my $second_utc=[1];
# first take the time and convert to epoch
# second normalize on GMT
my $first_normed='';
if ( $first_utc =~ m/(.*)\s((+|-)\d{4})$/) {
$first_normed=$1; #grab the date
$first_normed = time($firstnormed); # convert to epoch
my $offset=$2; # get the offset
# use offset to normalize to gmt
}
# repeat for second
# subtract first from second
# return difference
}
obviously i only did part of the work.
hope that helps you .
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs