mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-14 23:33:28 +00:00
@@ -523,16 +523,10 @@ when not defined(JS):
|
||||
var cTimeInfo = timeInfo # for C++ we have to make a copy
|
||||
# because the header of mktime is broken in my version of libc
|
||||
|
||||
when defined(windows):
|
||||
# On Windows `mktime` is broken enough to make this work.
|
||||
result = mktime(timeInfoToTM(cTimeInfo))
|
||||
# mktime is defined to interpret the input as local time. As timeInfoToTM
|
||||
# does ignore the timezone, we need to adjust this here.
|
||||
result = Time(TimeImpl(result) - getTimezone() + timeInfo.timezone)
|
||||
else:
|
||||
result = timegm(timeInfoToTM(cTimeInfo))
|
||||
# As timeInfoToTM does ignore the timezone, we need to adjust this here.
|
||||
result = Time(TimeImpl(result) + timeInfo.timezone)
|
||||
result = mktime(timeInfoToTM(cTimeInfo))
|
||||
# mktime is defined to interpret the input as local time. As timeInfoToTM
|
||||
# does ignore the timezone, we need to adjust this here.
|
||||
result = Time(TimeImpl(result) - getTimezone() + timeInfo.timezone)
|
||||
|
||||
proc timeInfoToTime(timeInfo: TimeInfo): Time = toTime(timeInfo)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user