| ... | @@ -1488,7 +1488,7 @@ fn formatDuration(data: FormatDurationData, comptime fmt: []const u8, options: s | ... | @@ -1488,7 +1488,7 @@ fn formatDuration(data: FormatDurationData, comptime fmt: []const u8, options: s |
| 1488 | var fbs = std.io.fixedBufferStream(&buf); | 1488 | var fbs = std.io.fixedBufferStream(&buf); |
| 1489 | var buf_writer = fbs.writer(); | 1489 | var buf_writer = fbs.writer(); |
| 1490 | if (data.negative) { | 1490 | if (data.negative) { |
| 1491 | try buf_writer.writeByte('-'); | 1491 | buf_writer.writeByte('-') catch unreachable; |
| 1492 | } | 1492 | } |
| 1493 | | 1493 | |
| 1494 | var ns_remaining = data.ns; | 1494 | var ns_remaining = data.ns; |
| ... | @@ -1501,8 +1501,8 @@ fn formatDuration(data: FormatDurationData, comptime fmt: []const u8, options: s | ... | @@ -1501,8 +1501,8 @@ fn formatDuration(data: FormatDurationData, comptime fmt: []const u8, options: s |
| 1501 | }) |unit| { | 1501 | }) |unit| { |
| 1502 | if (ns_remaining >= unit.ns) { | 1502 | if (ns_remaining >= unit.ns) { |
| 1503 | const units = ns_remaining / unit.ns; | 1503 | const units = ns_remaining / unit.ns; |
| 1504 | try formatInt(units, 10, .lower, .{}, buf_writer); | 1504 | formatInt(units, 10, .lower, .{}, buf_writer) catch unreachable; |
| 1505 | try buf_writer.writeByte(unit.sep); | 1505 | buf_writer.writeByte(unit.sep) catch unreachable; |
| 1506 | ns_remaining -= units * unit.ns; | 1506 | ns_remaining -= units * unit.ns; |
| 1507 | if (ns_remaining == 0) | 1507 | if (ns_remaining == 0) |
| 1508 | return formatBuf(fbs.getWritten(), options, writer); | 1508 | return formatBuf(fbs.getWritten(), options, writer); |
| ... | @@ -1516,7 +1516,7 @@ fn formatDuration(data: FormatDurationData, comptime fmt: []const u8, options: s | ... | @@ -1516,7 +1516,7 @@ fn formatDuration(data: FormatDurationData, comptime fmt: []const u8, options: s |
| 1516 | }) |unit| { | 1516 | }) |unit| { |
| 1517 | const kunits = ns_remaining * 1000 / unit.ns; | 1517 | const kunits = ns_remaining * 1000 / unit.ns; |
| 1518 | if (kunits >= 1000) { | 1518 | if (kunits >= 1000) { |
| 1519 | try formatInt(kunits / 1000, 10, .lower, .{}, buf_writer); | 1519 | formatInt(kunits / 1000, 10, .lower, .{}, buf_writer) catch unreachable; |
| 1520 | const frac = kunits % 1000; | 1520 | const frac = kunits % 1000; |
| 1521 | if (frac > 0) { | 1521 | if (frac > 0) { |
| 1522 | // Write up to 3 decimal places | 1522 | // Write up to 3 decimal places |
| ... | @@ -1526,15 +1526,15 @@ fn formatDuration(data: FormatDurationData, comptime fmt: []const u8, options: s | ... | @@ -1526,15 +1526,15 @@ fn formatDuration(data: FormatDurationData, comptime fmt: []const u8, options: s |
| 1526 | while (end > 1) : (end -= 1) { | 1526 | while (end > 1) : (end -= 1) { |
| 1527 | if (decimal_buf[end - 1] != '0') break; | 1527 | if (decimal_buf[end - 1] != '0') break; |
| 1528 | } | 1528 | } |
| 1529 | try buf_writer.writeAll(decimal_buf[0..end]); | 1529 | buf_writer.writeAll(decimal_buf[0..end]) catch unreachable; |
| 1530 | } | 1530 | } |
| 1531 | try buf_writer.writeAll(unit.sep); | 1531 | buf_writer.writeAll(unit.sep) catch unreachable; |
| 1532 | return formatBuf(fbs.getWritten(), options, writer); | 1532 | return formatBuf(fbs.getWritten(), options, writer); |
| 1533 | } | 1533 | } |
| 1534 | } | 1534 | } |
| 1535 | | 1535 | |
| 1536 | try formatInt(ns_remaining, 10, .lower, .{}, buf_writer); | 1536 | formatInt(ns_remaining, 10, .lower, .{}, buf_writer) catch unreachable; |
| 1537 | try buf_writer.writeAll("ns"); | 1537 | buf_writer.writeAll("ns") catch unreachable; |
| 1538 | return formatBuf(fbs.getWritten(), options, writer); | 1538 | return formatBuf(fbs.getWritten(), options, writer); |
| 1539 | } | 1539 | } |
| 1540 | | 1540 | |