Expose get_current_timestamp

Closes #152
This commit is contained in:
Vincent Prouillet 2021-02-19 21:08:30 +01:00
parent 30571cafd2
commit 2c9c57fc4b
2 changed files with 3 additions and 2 deletions

View File

@ -24,4 +24,4 @@ pub use decoding::{
};
pub use encoding::{encode, EncodingKey};
pub use header::Header;
pub use validation::Validation;
pub use validation::{get_current_timestamp, Validation};

View File

@ -97,7 +97,8 @@ impl Default for Validation {
}
}
fn get_current_timestamp() -> u64 {
/// Gets the current timestamp in the format JWT expect
pub fn get_current_timestamp() -> u64 {
let start = SystemTime::now();
start.duration_since(UNIX_EPOCH).expect("Time went backwards").as_secs()
}