INNER CODE UNIT · Rust
hours
szabodanika/microbin · src/pasta.rs:187
let hours = ((timenow - self.last_read) / 3600) as u16;
if hours > 1 {
return format!("{} hours ago", hours);
};
// it's less than 1 hour, let's do minutes then
let minutes = ((timenow - self.last_read) / 60) as u16;
if minutes > 1 {
return format!("{} minutes ago", minutes);
};
// it's less than 1 minute, let's do seconds then
let seconds = (timenow - self.last_read) as u16;
if seconds > 1 {
return format!("{} seconds ago", seconds);
};
// it's less than 1 second?????