Replace time with std::time in components/net (#31079)

* Replace time with std::time in components/net

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>

* Fix cookie::test_sort_order test

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>

---------

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>
This commit is contained in:
Taym Haddadi 2024-01-17 15:18:20 +01:00 committed by GitHub
parent d86e713a9c
commit 580062228b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 161 additions and 123 deletions

View file

@ -122,7 +122,10 @@ impl HttpState {
}
fn precise_time_ms() -> u64 {
time::precise_time_ns() / (1000 * 1000)
SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap_or_default()
.as_millis() as u64
}
// Step 3 of https://fetch.spec.whatwg.org/#concept-fetch.
@ -2108,7 +2111,6 @@ async fn cors_preflight_fetch(
.typed_get::<AccessControlMaxAge>()
.map(|acma| acma.into())
.unwrap_or(Duration::from_secs(5));
let max_age = max_age.as_secs() as u32;
// Substep 10
// TODO: Need to define what an imposed limit on max-age is