From 6804dcaf9afea50c480043ee2ec52306c2d6467e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaakko=20Ker=C3=A4nen?= Date: Fri, 25 Apr 2014 12:32:37 +0300 Subject: [PATCH] libdeng2|Time: Added time delta since start of native process --- doomsday/libdeng2/include/de/data/time.h | 6 ++++++ doomsday/libdeng2/src/data/time.cpp | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/doomsday/libdeng2/include/de/data/time.h b/doomsday/libdeng2/include/de/data/time.h index 4e4589eaa1..154e1d5746 100644 --- a/doomsday/libdeng2/include/de/data/time.h +++ b/doomsday/libdeng2/include/de/data/time.h @@ -109,6 +109,12 @@ class DENG2_PUBLIC Time : public ISerializable return Delta(milliseconds/1000.0); } + /** + * Determines the amount of time passed since the beginning of the native + * process (i.e., since creation of the high performance timer). + */ + static Delta sinceStartOfProcess(); + /** * Blocks the thread. */ diff --git a/doomsday/libdeng2/src/data/time.cpp b/doomsday/libdeng2/src/data/time.cpp index a899d7765b..35668dfdce 100644 --- a/doomsday/libdeng2/src/data/time.cpp +++ b/doomsday/libdeng2/src/data/time.cpp @@ -71,6 +71,11 @@ ddouble TimeDelta::asDays() const return asHours() / 24; } +Time::Delta Time::Delta::sinceStartOfProcess() +{ + return highPerfTimer.elapsed(); +} + void TimeDelta::sleep() const { if(_seconds < 60)