Develop first version (#1)
All checks were successful
continuous-integration/drone/push Build is passing
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
This commit is contained in:
19
src/time_utils.rs
Normal file
19
src/time_utils.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user