1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:37:45 +00:00

LibCore: Enable elapsed time as AK::Time on a ElapsedTimer

This commit is contained in:
Brian Gianforcaro 2021-09-11 20:24:37 -07:00 committed by Andreas Kling
parent e92b576cba
commit 1d4be9ca33
2 changed files with 7 additions and 0 deletions

View file

@ -34,4 +34,9 @@ int ElapsedTimer::elapsed() const
return diff.tv_sec * 1000 + diff.tv_usec / 1000;
}
Time ElapsedTimer::elapsed_time() const
{
return Time::from_milliseconds(elapsed());
}
}

View file

@ -6,6 +6,7 @@
#pragma once
#include <AK/Time.h>
#include <sys/time.h>
namespace Core {
@ -20,6 +21,7 @@ public:
bool is_valid() const { return m_valid; }
void start();
int elapsed() const;
Time elapsed_time() const;
const struct timeval& origin_time() const { return m_origin_time; }