mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 08:36:15 +00:00
LibCore: Expose origin timestamp of Core::ElapsedTime
This commit is contained in:
@@ -37,8 +37,8 @@ void ElapsedTimer::start()
|
||||
m_valid = true;
|
||||
timespec now_spec;
|
||||
clock_gettime(CLOCK_MONOTONIC, &now_spec);
|
||||
m_start_time.tv_sec = now_spec.tv_sec;
|
||||
m_start_time.tv_usec = now_spec.tv_nsec / 1000;
|
||||
m_origin_time.tv_sec = now_spec.tv_sec;
|
||||
m_origin_time.tv_usec = now_spec.tv_nsec / 1000;
|
||||
}
|
||||
|
||||
int ElapsedTimer::elapsed() const
|
||||
@@ -50,7 +50,7 @@ int ElapsedTimer::elapsed() const
|
||||
now.tv_sec = now_spec.tv_sec;
|
||||
now.tv_usec = now_spec.tv_nsec / 1000;
|
||||
struct timeval diff;
|
||||
timeval_sub(now, m_start_time, diff);
|
||||
timeval_sub(now, m_origin_time, diff);
|
||||
return diff.tv_sec * 1000 + diff.tv_usec / 1000;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user