Thread overview
[Issue 5552] New: std.datetime.d DosFileTimeToSysTime has a bug
Feb 09, 2011
soarowl@yeah.net
Feb 09, 2011
Jonathan M Davis
Feb 12, 2011
Jonathan M Davis
February 09, 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@puremagic.com
        ReportedBy: soarowl@yeah.net


--- Comment #0 from soarowl@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: -------
February 09, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5552


Jonathan M Davis <jmdavisProg@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |jmdavisProg@gmx.com


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 12, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5552


Jonathan M Davis <jmdavisProg@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


--- Comment #1 from Jonathan M Davis <jmdavisProg@gmx.com> 2011-02-12 06:10:07 PST ---
Fixed in commit: https://github.com/D-Programming-Language/phobos/commit/0e69424fa4d471bb2a73e88e778df7f50c762236

Merged into main repository: https://github.com/D-Programming-Language/phobos/commit/c852cd650cf0aec9bd08b33b297641b28e859737

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