summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibCore/ElapsedTimer.cpp
diff options
context:
space:
mode:
authorBrian Gianforcaro <bgianf@serenityos.org>2021-09-12 08:21:16 -0700
committerBrian Gianforcaro <b.gianfo@gmail.com>2021-09-12 17:24:44 +0000
commita2ee38768309814af44dc630f8b6f9fb5ff0b9b3 (patch)
treec2ebbedf4bb3520521ae85f9d5c071a553016e9e /Userland/Libraries/LibCore/ElapsedTimer.cpp
parent500a3fb2a7a126fd2cf74eac3bc342e87549eb2c (diff)
downloadserenity-a2ee38768309814af44dc630f8b6f9fb5ff0b9b3.zip
LibCore: Add factory to create and start a new ElapsedTimer
Simplifies one of the main usage patterns of the timer class.
Diffstat (limited to 'Userland/Libraries/LibCore/ElapsedTimer.cpp')
-rw-r--r--Userland/Libraries/LibCore/ElapsedTimer.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/Userland/Libraries/LibCore/ElapsedTimer.cpp b/Userland/Libraries/LibCore/ElapsedTimer.cpp
index 96490310cf..59b4b4cd95 100644
--- a/Userland/Libraries/LibCore/ElapsedTimer.cpp
+++ b/Userland/Libraries/LibCore/ElapsedTimer.cpp
@@ -12,6 +12,13 @@
namespace Core {
+ElapsedTimer ElapsedTimer::start_new()
+{
+ ElapsedTimer timer;
+ timer.start();
+ return timer;
+}
+
void ElapsedTimer::start()
{
m_valid = true;