develooper Front page | perl.datetime | Postings from January 2003

Re: Changing time zones?

Thread Previous | Thread Next
From:
John Peacock
Date:
January 31, 2003 03:41
Subject:
Re: Changing time zones?
Message ID:
3E3A60D0.1090705@rowman.com
Bruce Van Allen wrote:
> On Thursday, January 30, 2003, at 05:52  PM, John Peacock wrote:
> 
>> Store in UTC (always).
> 
> 
> John, is there a principle that could be stated, behind your 'NSHO'? 
> This seems clear to me, but then I wonder if I'm trapped in some thought 
> rigidity.

Let me think out loud now.  If we are always storing time _and_ TZ, then it 
certainly make more sense to me to use UTC to store the time.  How's this for a 
good example (pseudo-code):

	my $t1 = new DateTime::Simple ("2002-12-30T08:00:00", TZ => "EST");
	my $t2 = new DateTime::Simple ("2002-12-30T08:00:00", TZ => "MST");

	my $diff = $t2-$t1;

If we store the internal value as UTC, then differences are a simple matter of 
taking the difference between the internal UTC values.  If we don't store 
internally as UTC, then we would need to adjust each $t to a common TZ prior to 
mathematic operations.

Besides, the whole idea behind UTC was to act as a common timezone that everyone 
could use (with the appropriate offset).

John

-- 
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4720 Boston Way
Lanham, MD 20706
301-459-3366 x.5010
fax 301-429-5747


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About