mirror of
https://github.com/Hopiu/lychee.git
synced 2026-05-17 10:11:07 +00:00
16 lines
358 B
Rust
16 lines
358 B
Rust
|
|
use std::time::SystemTime;
|
||
|
|
|
||
|
|
pub(crate) type Timestamp = u64;
|
||
|
|
|
||
|
|
/// Get the current UNIX timestamp
|
||
|
|
///
|
||
|
|
/// # Panics
|
||
|
|
///
|
||
|
|
/// Panics when the system clock is incorrectly configured
|
||
|
|
pub(crate) fn timestamp() -> Timestamp {
|
||
|
|
SystemTime::now()
|
||
|
|
.duration_since(SystemTime::UNIX_EPOCH)
|
||
|
|
.expect("SystemTime before UNIX EPOCH!")
|
||
|
|
.as_secs()
|
||
|
|
}
|