From 534c97edc54ffb6d55baa5084f8c426a451c9244 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 --- 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 80be55884ef3..7cd47596d165 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 000000000000..afe319e6cf46 --- /dev/null +++ b/tests/misc/t16264.nim @@ -0,0 +1,2 @@ +import times +doAssert low(Time) == fromUnix(0) \ No newline at end of file