diff options
author | Bung <crc32@qq.com> | 2022-10-29 14:59:51 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-29 08:59:51 +0200 |
commit | 534c97edc54ffb6d55baa5084f8c426a451c9244 (patch) | |
tree | 0b9c08db2e20b46f04236f3d0054e745894b7fc4 | |
parent | 66f958b313ce5a10c5c4320e50dbce01803c35e6 (diff) | |
download | Nim-534c97edc54ffb6d55baa5084f8c426a451c9244.tar.gz |
fix #16264 low(Time) OverflowDefect (#20552)
fix #16264 regression(0.18.0 => devel): import times; echo low(Time) gives OverflowDefect
-rw-r--r-- | lib/pure/times.nim | 2 | ||||
-rw-r--r-- | tests/misc/t16264.nim | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/lib/pure/times.nim b/lib/pure/times.nim index 80be55884..7cd47596d 100644 --- a/lib/pure/times.nim +++ b/lib/pure/times.nim @@ -1018,7 +1018,7 @@ proc high*(typ: typedesc[Time]): Time = initTime(high(int64), high(NanosecondRange)) proc low*(typ: typedesc[Time]): Time = - initTime(low(int64), 0) + initTime(0, 0) # # DateTime & Timezone diff --git a/tests/misc/t16264.nim b/tests/misc/t16264.nim new file mode 100644 index 000000000..afe319e6c --- /dev/null +++ b/tests/misc/t16264.nim @@ -0,0 +1,2 @@ +import times +doAssert low(Time) == fromUnix(0) \ No newline at end of file |