mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
LibWeb: Store response creation time as MonotonicTime
This non-standard value is used for calculating durations relative to when the response was created. MonotonicTime is more suitable for this use case.
This commit is contained in:
parent
1d207aa0d8
commit
ddea1c6248
Notes:
github-actions[bot]
2025-01-27 13:54:56 +00:00
Author: https://github.com/tcl3
Commit: ddea1c6248
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3341
2 changed files with 5 additions and 5 deletions
|
@ -25,7 +25,7 @@ GC_DEFINE_ALLOCATOR(OpaqueRedirectFilteredResponse);
|
|||
|
||||
Response::Response(GC::Ref<HeaderList> header_list)
|
||||
: m_header_list(header_list)
|
||||
, m_response_time(UnixDateTime::now())
|
||||
, m_response_time(MonotonicTime::now())
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -257,14 +257,14 @@ u64 Response::current_age() const
|
|||
|
||||
// The term "date_value" denotes the value of the Date header field, in a form appropriate for arithmetic operations. See Section 6.6.1 of [HTTP] for the definition of the Date header field and for requirements regarding responses without it.
|
||||
// FIXME: Do we have a parser for HTTP-date?
|
||||
auto const date_value = UnixDateTime::now() - AK::Duration::from_seconds(5);
|
||||
auto const date_value = MonotonicTime::now() - AK::Duration::from_seconds(5);
|
||||
|
||||
// The term "now" means the current value of this implementation's clock (Section 5.6.7 of [HTTP]).
|
||||
auto const now = UnixDateTime::now();
|
||||
auto const now = MonotonicTime::now();
|
||||
|
||||
// The value of the clock at the time of the request that resulted in the stored response.
|
||||
// FIXME: Let's get the correct time.
|
||||
auto const request_time = UnixDateTime::now() - AK::Duration::from_seconds(5);
|
||||
auto const request_time = MonotonicTime::now() - AK::Duration::from_seconds(5);
|
||||
|
||||
// The value of the clock at the time the response was received.
|
||||
auto const response_time = m_response_time;
|
||||
|
|
|
@ -198,7 +198,7 @@ private:
|
|||
|
||||
// Non-standard
|
||||
ByteBuffer m_method;
|
||||
UnixDateTime m_response_time;
|
||||
MonotonicTime m_response_time;
|
||||
|
||||
Optional<Variant<String, StringView>> m_network_error_message;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue