diff options
author | skilchen <skilchen@users.noreply.github.com> | 2018-04-18 13:22:05 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-04-18 13:22:05 +0200 |
commit | a708fda733cb6605ef122ac3be44df59929a6473 (patch) | |
tree | 1db7a61f8b558f5bdf16f5cf32b46905f13a7fda | |
parent | 9d4fd1f1bbc0d8a2327699dd07283260d85a5245 (diff) | |
download | Nim-a708fda733cb6605ef122ac3be44df59929a6473.tar.gz |
allow stringification of DurationZero (#7625)
-rw-r--r-- | lib/pure/times.nim | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/pure/times.nim b/lib/pure/times.nim index 673f0b030..29492379d 100644 --- a/lib/pure/times.nim +++ b/lib/pure/times.nim @@ -353,7 +353,9 @@ proc `$`*(dur: Duration): string = parts.add $quantity & " " & unitStrings[unit] & "s" result = "" - if parts.len == 1: + if parts.len == 0: + result.add "0 nanoseconds" + elif parts.len == 1: result = parts[0] elif parts.len == 2: result = parts[0] & " and " & parts[1] |