B:BD[
2.7424] → [
2.7424:7621]
pub fn new(hours: i32, minutes: i32) -> Self {
unimplemented!(
"Construct a new Clock from {} hours and {} minutes",
hours,
minutes
);
}
pub fn new(hours: i32, minutes: i32) -> Self {
Self {
minutes: (hours * MINUTES_PER_HOUR + minutes).rem_euclid(MINUTES_PER_DAY),
}
}
pub fn add_minutes(&self, minutes: i32) -> Self {
Self::new(0, self.minutes + minutes)
}
fn minutes(&self) -> i32 {
self.minutes % MINUTES_PER_HOUR
}
fn hours(&self) -> i32 {
self.minutes / MINUTES_PER_HOUR
}
}