[Bf-blender-cvs] [fe739f8c264] master: GHOST: fix GHOST_System::getMilliSeconds()

Christian Rauch noreply at git.blender.org
Fri May 22 10:09:31 CEST 2020


Commit: fe739f8c2647fef4fdd5426dc2a27b61614dba7f
Author: Christian Rauch
Date:   Fri May 22 18:06:13 2020 +1000
Branches: master
https://developer.blender.org/rBfe739f8c2647fef4fdd5426dc2a27b61614dba7f

GHOST: fix GHOST_System::getMilliSeconds()

This wasn't returning milliseconds, causing problems with key repeat.

===================================================================

M	intern/ghost/intern/GHOST_System.cpp

===================================================================

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,



More information about the Bf-blender-cvs mailing list