diff options
author | Araq <rumpf_a@web.de> | 2016-11-29 10:36:42 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2016-11-29 10:36:42 +0100 |
commit | 82448b1304057c7c6f12a61cd5a8d94f4915247a (patch) | |
tree | 4f6c817cb7ac6300502406574bfbdc54828ecaab /lib | |
parent | 49667798eb2fcd6cee5754bf450bc9ccef2a8ed2 (diff) | |
download | Nim-82448b1304057c7c6f12a61cd5a8d94f4915247a.tar.gz |
times.nim: remove code duplication
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/times.nim | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/lib/pure/times.nim b/lib/pure/times.nim index 1767a37be..248d397a7 100644 --- a/lib/pure/times.nim +++ b/lib/pure/times.nim @@ -514,14 +514,6 @@ when not defined(JS): # copying is needed anyway to provide reentrancity; thus # the conversion is not expensive - proc timeInfoToTime(timeInfo: TimeInfo): Time = - var cTimeInfo = timeInfo # for C++ we have to make a copy, - # because the header of mktime is broken in my version of libc - 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 toTime(timeInfo: TimeInfo): Time = var cTimeInfo = timeInfo # for C++ we have to make a copy, # because the header of mktime is broken in my version of libc @@ -530,6 +522,8 @@ when not defined(JS): # does ignore the timezone, we need to adjust this here. result = Time(TimeImpl(result) - getTimezone() + timeInfo.timezone) + proc timeInfoToTime(timeInfo: TimeInfo): Time = toTime(timeInfo) + const epochDiff = 116444736000000000'i64 rateDiff = 10000000'i64 # 100 nsecs |