allow stringification of DurationZero (#7625)
This commit is contained in:
parent
9d4fd1f1bb
commit
a708fda733
1 changed files with 3 additions and 1 deletions
|
|
@ -353,7 +353,9 @@ proc `$`*(dur: Duration): string =
|
||||||
parts.add $quantity & " " & unitStrings[unit] & "s"
|
parts.add $quantity & " " & unitStrings[unit] & "s"
|
||||||
|
|
||||||
result = ""
|
result = ""
|
||||||
if parts.len == 1:
|
if parts.len == 0:
|
||||||
|
result.add "0 nanoseconds"
|
||||||
|
elif parts.len == 1:
|
||||||
result = parts[0]
|
result = parts[0]
|
||||||
elif parts.len == 2:
|
elif parts.len == 2:
|
||||||
result = parts[0] & " and " & parts[1]
|
result = parts[0] & " and " & parts[1]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue