in reply to Simple (I thought) time comparison?

Your constructor sets time in terms of localtime. Your half-hour calcuation subtracts a half hour from the object that was based on localtime. Your $oldtime object is constructed using strptime, and is not setting a timezone offset.

You can see this in action by adding the following lines:

print "\$ctime tzoffset: ", $ctime->tzoffset, "\n"; print "\$halfago tzoffset: ", $halfago->tzoffset, "\n"; print "\$oldtime tzoffset: ", $oldtime->tzoffset, "\n";

which will produce output along the line of:

$ctime tzoffset: -25200 $halfago tzoffset: -25200 $oldtime tzoffset: 0

(...except that the offsets will be in your own localtime, not mine.)

You might be able to set the $oldtime->tzoffset($some_value), or preferably by providing a %Z or %z field to strptime.


Dave