[Mono-bugs] [Bug 666355] New: UnixFileInfo.LastWriteTime is 1hr off for Daylight Saving Time mtimes

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Jan 21 21:54:04 EST 2011


https://bugzilla.novell.com/show_bug.cgi?id=666355

https://bugzilla.novell.com/show_bug.cgi?id=666355#c0


           Summary: UnixFileInfo.LastWriteTime is 1hr off for Daylight
                    Saving Time mtimes
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.8.x
          Platform: x86
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Mono.POSIX
        AssignedTo: miguel at novell.com
        ReportedBy: cce32 at yahoo.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Created an attachment (id=409647)
 --> (http://bugzilla.novell.com/attachment.cgi?id=409647)
Simple test case

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.11)
Gecko/20101012 Firefox/3.6.11

Comparing the output from FileInfo and UnixFileInfo for files created during
PDT are one hour different.

Reproducible: Always

Steps to Reproduce:
Update the last modified of a file to 11-06-2010 02:02:02 and compare it to one
set to 11-08-2010 02:02:02 or run the attached test case.
Actual Results:  
LastWriteTime=11/6/2010 2:02:02 AM for pdt.txt from System.IO.FileInfo
LastWriteTime=11/6/2010 1:02:02 AM for pdt.txt from Mono.Unix.UnixFileInfo
LastWriteTime=11/8/2010 2:02:02 AM for pst.txt from System.IO.FileInfo
LastWriteTime=11/8/2010 2:02:02 AM for pst.txt from Mono.Unix.UnixFileInfo


Expected Results:  
All the times should be 2:02:02

I think the problem is in NativeConvert.cs in FromTimeT

DateTime r=LocalUnixEpoch.AddSeconds((double)time+LocalUtcOffset.TotalSeconds);

LocalUtcOffset should be the offset for the time in question not the current
time.


This seems to work for me:
DateTime
r=pdtdt.AddSeconds(TimeZone.CurrentTimeZone.GetUtcOffset(pdtdt).TotalSeconds);

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list