Skip to content

Commit 045dd9d

Browse files
committed
for good measure, use unsigned_abs() for a variant that can't panic.
Otherwise `N::MIN` can't be turned unto that same type abs version, but it can fit into its unsiged version of the type.
1 parent 9b1a575 commit 045dd9d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

gix-date/src/time/write.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ impl Time {
2323

2424
const ZERO: &[u8; 1] = b"0";
2525

26-
const SECONDS_PER_HOUR: i32 = 60 * 60;
27-
let offset = self.offset.abs();
26+
const SECONDS_PER_HOUR: u32 = 60 * 60;
27+
let offset = self.offset.unsigned_abs();
2828
let hours = offset / SECONDS_PER_HOUR;
2929
assert!(hours < 25, "offset is more than a day: {hours}");
3030
let minutes = (offset - (hours * SECONDS_PER_HOUR)) / 60;

0 commit comments

Comments
 (0)