add NanoDuration.to_format() (#935)

* lib/std/time: avoid switch in DateTime.compare_to()
* lib/std/time: add NanoDuration.to_format()
* std/lib: fix #934
This commit is contained in:
Pierre Curto
2023-08-17 10:30:20 +02:00
committed by GitHub
parent 9b0da89a03
commit 7a39933c97
5 changed files with 117 additions and 17 deletions

View File

@@ -141,7 +141,7 @@ fn void! Formatter.out_substr(&self, String str) @private
usz l = conv::utf8_codepoints(str);
uint prec = self.prec;
if (self.flags.precision && l < prec) l = prec;
self.right_adjust(' ')!;
self.right_adjust(l)!;
usz index = 0;
usz chars = str.len;
char* ptr = str.ptr;