Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

utime: still with bug?

4 views
Skip to first unread message

Axel Friedrich

unread,
Mar 1, 2006, 2:44:27 PM3/1/06
to
Hello,

with ruby 1.8.4 on Windows XP, there seems still to be an error of 1
hour when assigning mtime to a file by using utime.

Condition: Assigning a daylight saving time while actual time is not
daylight saving time.

The same seems to be OK on Windows 98SE.

I tested it as described in:
<longLine>
http://groups.google.com/group/comp.lang.ruby/browse_frm/thread/fe4a0
342986ebd71
</longLine>


Is there a fix or work-around?


I'm using:
ruby 1.8.4 (2005-12-24) [i386-mswin32] on both systems.


Axel

Berger, Daniel

unread,
Mar 1, 2006, 3:55:10 PM3/1/06
to
> -----Original Message-----
> From: Axel Friedrich [mailto:aaa...@dfgh.net]
> Sent: Wednesday, March 01, 2006 12:49 PM
> To: ruby-talk ML
> Subject: utime: still with bug?
>
>
> Hello,
>
> with ruby 1.8.4 on Windows XP, there seems still to be an error of 1
> hour when assigning mtime to a file by using utime.
>
> Condition: Assigning a daylight saving time while actual time is not
> daylight saving time.
>
> The same seems to be OK on Windows 98SE.
>
> I tested it as described in:
> <longLine>
> http://groups.google.com/group/comp.lang.ruby/browse_frm/thread/fe4a0
> 342986ebd71
> </longLine>
>
>
> Is there a fix or work-around?

I think the bug is actually in Window's utime() implementation, based on
what I've read from this Perl module's description:

http://search.cpan.org/~shay/Win32-UTCFileTime-1.45/lib/Win32/UTCFileTim
e.pm

Regards,

Dan


H.Yamamoto

unread,
Mar 1, 2006, 10:46:55 PM3/1/06
to
Hello.

Sorry, this is regression I introduced when fixed another bug of stat(2) on WinNT.

Index: win32.c
===================================================================
RCS file: /src/ruby/win32/win32.c,v
retrieving revision 1.186
diff -u -w -b -p -r1.186 win32.c
--- win32.c 24 Feb 2006 02:19:44 -0000 1.186
+++ win32.c 2 Mar 2006 03:39:48 -0000
@@ -3223,6 +3223,7 @@ filetime_to_unixtime(const FILETIME *ft)
tm.tm_hour = st.wHour;
tm.tm_min = st.wMinute;
tm.tm_sec = st.wSecond;
+ tm.tm_isdst = -1;
t = mktime(&tm);
return t == -1 ? 0 : t;
}

I'll commit this on CVS.

Axel Friedrich

unread,
Mar 2, 2006, 1:30:47 AM3/2/06
to

> I'll commit this on CVS.

Thank You! (I'm looking forward to get the "right" utime.)

> http://search.cpan.org/~shay/Win32-UTCFileTime-
1.45/lib/Win32/UTCFileTime.pm

*Very* interesting; and even the presentation of the solution in
chapter "The Final Solution" and "More problems: utime()".

Axel

0 new messages