INNER CODE UNIT · Rust

minutes

szabodanika/microbin · src/pasta.rs:193

        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?????
        String::from("just now")
    }

    pub fn short_last_read_time_ago_as_string(&self) -> String {
        // get current unix time in seconds
        let timenow: i64 = match SystemTime::now().duration_since(UNIX_EPOCH) {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…