summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJamesP <jlp765@gmail.com>2015-09-10 17:38:00 +1000
committerJamesP <jlp765@gmail.com>2015-09-10 17:38:00 +1000
commitc122d71e66e9edbbeb9f6bb32475321447439862 (patch)
tree8398a4cd9c573db656e7c089c4c6b575200b5359
parent612cd2161aa1a145cc11f559b135a948f972f344 (diff)
downloadNim-c122d71e66e9edbbeb9f6bb32475321447439862.tar.gz
bug fix: `+` and `-` handle GM and Local time correctly
eg,  getGmTime(getTime()) + initInterval(hours=1) gave incorrect results
-rw-r--r--lib/pure/times.nim16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/pure/times.nim b/lib/pure/times.nim
index 5d960b11a..f0455baac 100644
--- a/lib/pure/times.nim
+++ b/lib/pure/times.nim
@@ -307,10 +307,10 @@ proc `+`*(a: TimeInfo, interval: TimeInterval): TimeInfo =
   ## very accurate.
   let t = toSeconds(timeInfoToTime(a))
   let secs = toSeconds(a, interval)
-  if a.tzname == "UTC":
-    result = getGMTime(fromSeconds(t + secs))
-  else:
-    result = getLocalTime(fromSeconds(t + secs))
+  #if a.tzname == "UTC":
+  #  result = getGMTime(fromSeconds(t + secs))
+  #else:
+  result = getLocalTime(fromSeconds(t + secs))
 
 proc `-`*(a: TimeInfo, interval: TimeInterval): TimeInfo =
   ## subtracts ``interval`` time.
@@ -319,10 +319,10 @@ proc `-`*(a: TimeInfo, interval: TimeInterval): TimeInfo =
   ## when you subtract so much that you reach the Julian calendar.
   let t = toSeconds(timeInfoToTime(a))
   let secs = toSeconds(a, interval)
-  if a.tzname == "UTC":
-    result = getGMTime(fromSeconds(t - secs))
-  else:
-    result = getLocalTime(fromSeconds(t - secs))
+  #if a.tzname == "UTC":
+  #  result = getGMTime(fromSeconds(t - secs))
+  #else:
+  result = getLocalTime(fromSeconds(t - secs))
 
 when not defined(JS):
   proc epochTime*(): float {.rtl, extern: "nt$1", tags: [TimeEffect].}