[Issue 14172] New: on windows , core.stdc.time.time function return value is wrong

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Feb 12 00:34:12 PST 2015


https://issues.dlang.org/show_bug.cgi?id=14172

          Issue ID: 14172
           Summary: on windows , core.stdc.time.time function return value
                    is wrong
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: druntime
          Assignee: nobody at puremagic.com
          Reporter: lplus at 126.com

//on windows core.stdc.time.time function return value is wrong
//but use it as localtime param is right

//D
import core.stdc.time;

void main()
{
    time_t t;  
    time(&t);
    writeln(t);               // results a wrong value; very different with
vc's result
    tm* stp = localtime(&t);  // but this return value is right;
    // ...
}

// C(vc++)
#include <time.h>
int main()
{
    time_t t;
    time(&t);
    printf("%d\n", t);        // this is right
    // ...
}

--


More information about the Digitalmars-d-bugs mailing list