From b2b226bb2873132181b2ca87c07e7f602b373889 Mon Sep 17 00:00:00 2001 From: Bung Date: Sat, 29 Oct 2022 14:59:51 +0800 Subject: [PATCH] fix #16264 low(Time) OverflowDefect (#20552) fix #16264 regression(0.18.0 => devel): import times; echo low(Time) gives OverflowDefect (cherry picked from commit 534c97edc54ffb6d55baa5084f8c426a451c9244) --- lib/pure/times.nim | 2 +- tests/misc/t16264.nim | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 tests/misc/t16264.nim diff --git a/lib/pure/times.nim b/lib/pure/times.nim index 113f73d2a6..a2e5f494d6 100644 --- a/lib/pure/times.nim +++ b/lib/pure/times.nim @@ -959,7 +959,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 0000000000..afe319e6cf --- /dev/null +++ b/tests/misc/t16264.nim @@ -0,0 +1,2 @@ +import times +doAssert low(Time) == fromUnix(0) \ No newline at end of file