INNER CODE UNIT · Rust

format_timestamp

rustic-rs/rustic · src/config.rs:288

    pub fn format_timestamp(&self, timestamp: Timestamp) -> String {
        self.format_time(&timestamp.to_zoned(TimeZone::UTC))
            .to_string()
    }

    pub fn format_time(&self, time: &Zoned) -> impl Display {
        if self.show_time_offset {
            time.strftime("%Y-%m-%d %H:%M:%S%z")
        } else {
            let tz = TimeZone::system();
            if time.offset() == tz.to_offset(time.timestamp()) {
                time.strftime("%Y-%m-%d %H:%M:%S")
            } else {
                time.with_time_zone(tz).strftime("%Y-%m-%d %H:%M:%S*")
            }
        }
    }
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…