Hi,

At Sat, 1 Jan 2005 09:40:34 +0900,
Steven Jenkins wrote in [ruby-core:04065]:
> Looking at the code in time.c, it's clear that time_sec() indirectly 
> calls either time_localtime() or time_gmtime(), both of which modify the 
> receiver. Is this side effect intended? If so, should the documentation 
> be updated? It was a bit of a suprise to me.

Do you mean the Time object returned by Time#getlocal should
always reset its timezone?


Index: time.c =================================================================== RCS file: /cvs/ruby/src/ruby/time.c,v retrieving revision 1.102 diff -p -U2 -r1.102 time.c --- time.c 23 Jun 2004 12:59:01 -0000 1.102 +++ time.c 4 Jan 2005 10:55:44 -0000 @@ -1165,5 +1165,10 @@ time_getlocaltime(time) VALUE time; { - return time_localtime(time_dup(time)); + struct time_object *tobj; + + time = time_dup(time); + GetTimeval(time, tobj); + tobj->tm_got = 0; + return time_localtime(time); }
-- Nobu Nakada