Merge pull request #3161 from barcharcraz/fix_times_on_vcc2015

import the correct symbols on windows
This commit is contained in:
Dominik Picheta
2015-08-03 17:08:14 +01:00

View File

@@ -26,11 +26,6 @@ type
WeekDay* = enum ## represents a weekday
dMon, dTue, dWed, dThu, dFri, dSat, dSun
when not defined(JS):
var
timezone {.importc, header: "<time.h>".}: int
tzname {.importc, header: "<time.h>" .}: array[0..1, cstring]
when defined(posix) and not defined(JS):
type
TimeImpl {.importc: "time_t", header: "<time.h>".} = int
@@ -49,6 +44,9 @@ when defined(posix) and not defined(JS):
proc posix_gettimeofday(tp: var Timeval, unused: pointer = nil) {.
importc: "gettimeofday", header: "<sys/time.h>".}
var
timezone {.importc, header: "<time.h>".}: int
tzname {.importc, header: "<time.h>" .}: array[0..1, cstring]
# we also need tzset() to make sure that tzname is initialized
proc tzset() {.importc, header: "<time.h>".}
# calling tzset() implicitly to initialize tzname data.
@@ -60,11 +58,19 @@ elif defined(windows):
when defined(vcc):
# newest version of Visual C++ defines time_t to be of 64 bits
type TimeImpl {.importc: "time_t", header: "<time.h>".} = int64
# visual c's c runtime exposes these under a different name
var
timezone {.importc: "_timezone", header: "<time.h>".}: int
tzname {.importc: "_tzname", header: "<time.h>"}: array[0..1, cstring]
else:
type TimeImpl {.importc: "time_t", header: "<time.h>".} = int32
var
timezone {.importc, header: "<time.h>".}: int
tzname {.importc, header: "<time.h>" .}: array[0..1, cstring]
type
Time* = distinct TimeImpl
elif defined(JS):
type