diff options
author | Christian Rauch <Rauch.Christian@gmx.de> | 2020-05-22 11:06:13 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-05-22 11:08:13 +0300 |
commit | fe739f8c2647fef4fdd5426dc2a27b61614dba7f (patch) | |
tree | 80132642a9893ec2fe9e2fd2a4f3d34299e060ec /intern/ghost | |
parent | ce6fd6b6a239e7a82be99c621ff54f90b93daaaf (diff) |
GHOST: fix GHOST_System::getMilliSeconds()
This wasn't returning milliseconds, causing problems with key repeat.
Diffstat (limited to 'intern/ghost')
-rw-r--r-- | intern/ghost/intern/GHOST_System.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/intern/ghost/intern/GHOST_System.cpp b/intern/ghost/intern/GHOST_System.cpp index 587e4c28102..b0d2adff4bc 100644 --- a/intern/ghost/intern/GHOST_System.cpp +++ b/intern/ghost/intern/GHOST_System.cpp @@ -23,8 +23,8 @@ #include "GHOST_System.h" +#include <chrono> #include <stdio.h> /* just for printf */ -#include <time.h> #include "GHOST_DisplayManager.h" #include "GHOST_EventManager.h" @@ -58,12 +58,9 @@ GHOST_System::~GHOST_System() GHOST_TUns64 GHOST_System::getMilliSeconds() const { - GHOST_TUns64 millis = ::clock(); - if (CLOCKS_PER_SEC != 1000) { - millis *= 1000; - millis /= CLOCKS_PER_SEC; - } - return millis; + return std::chrono::duration_cast<std::chrono::milliseconds>( + std::chrono::steady_clock::now().time_since_epoch()) + .count(); } GHOST_ITimerTask *GHOST_System::installTimer(GHOST_TUns64 delay, |