Pierre Hubert
394e29ae55
All checks were successful
continuous-integration/drone/push Build is passing
Create first version of the library The code is mainly taken from * https://gitea.communiquons.org/pierre/oidc-test-client * https://gitea.communiquons.org/pierre/BasicOIDC with little improvements. Reviewed-on: #1
20 lines
357 B
Rust
20 lines
357 B
Rust
use std::time::{SystemTime, UNIX_EPOCH};
|
|
|
|
/// Get current time since epoch, in seconds
|
|
pub fn time() -> u64 {
|
|
SystemTime::now()
|
|
.duration_since(UNIX_EPOCH)
|
|
.unwrap()
|
|
.as_secs()
|
|
}
|
|
|
|
#[cfg(test)]
|
|
mod test {
|
|
use crate::time_utils::time;
|
|
|
|
#[test]
|
|
fn time_is_recent_enough() {
|
|
assert!(time() > 1682750570);
|
|
}
|
|
}
|