diff --git a/game/src/sandbox/speed.rs b/game/src/sandbox/speed.rs index 9120a9b383..f937910778 100644 --- a/game/src/sandbox/speed.rs +++ b/game/src/sandbox/speed.rs @@ -398,7 +398,8 @@ impl TimePanel { let width = 300.0; let y1 = 5.0; let height = Distance::meters(15.0); - let percent = ui.primary.sim.time().to_percent(Time::END_OF_DAY); + // Just clamp past 24 hours + let percent = ui.primary.sim.time().to_percent(Time::END_OF_DAY).min(1.0); // TODO rounded batch.push( diff --git a/geom/src/time.rs b/geom/src/time.rs index de83ac4899..acfb08c0fd 100644 --- a/geom/src/time.rs +++ b/geom/src/time.rs @@ -49,14 +49,14 @@ impl Time { pub fn ampm_tostring(self) -> String { let (mut hours, minutes, seconds, remainder) = self.get_parts(); - let suffix = if hours < 12 { - "AM" - } else if hours < 24 { - "PM" + let next_day = if hours >= 24 { + let days = hours / 24; + hours = hours % 24; + format!(" (+{} days)", days) } else { - // Give up on the AM/PM distinction I guess. This shouldn't be used much. - "(+1 day)" + "".to_string() }; + let suffix = if hours < 12 { "AM" } else { "PM" }; if hours == 0 { hours = 12; } else if hours >= 24 { @@ -66,8 +66,8 @@ impl Time { } format!( - "{:02}:{:02}:{:02}.{:01} {}", - hours, minutes, seconds, remainder, suffix + "{:02}:{:02}:{:02}.{:01} {}{}", + hours, minutes, seconds, remainder, suffix, next_day ) }