[Issue 5552] New: std.datetime.d DosFileTimeToSysTime has a bug

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Feb 8 18:51:39 PST 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5552

           Summary: std.datetime.d DosFileTimeToSysTime has a bug
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: soarowl at yeah.net


--- Comment #0 from soarowl at yeah.net 2011-02-08 18:49:15 PST ---
import 
    std.datetime,
    std.stdio;

void main()
{
    auto time = cast(DosFileTime)0x3E3F8456; 
    writeln(DosFileTimeToSysTime(time)); //output should: 2011-Jan-31 16:34:44
}


Compile and run above snipplet, will get an exception.

Solution: change std.datetime.d at line 31820 from

  int month = ((dt >> 21) & 0x0F) - 1;       // 1..12

to 

  int month = ((dt >> 21) & 0x0F);       // 1..12

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list