INNER CODE UNIT · Rust

seconds

szabodanika/microbin · src/pasta.rs:199

        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) {
            Ok(n) => n.as_secs(),
            Err(_) => {
                log::error!("SystemTime before UNIX EPOCH!");
                0
            }
        } as i64;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…