(Vector) Replace std::chrono::system_clock with chrono::steady_clock 24/263124/1
authorHeeyong Song <heeyong.song@samsung.com>
Thu, 26 Aug 2021 09:48:37 +0000 (18:48 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Thu, 26 Aug 2021 09:49:40 +0000 (18:49 +0900)
Change-Id: If2cfb975c8796963d38141ae3c1868ee385b40c1

dali-toolkit/internal/visuals/animated-vector-image/vector-animation-task.cpp
dali-toolkit/internal/visuals/animated-vector-image/vector-animation-task.h
dali-toolkit/internal/visuals/animated-vector-image/vector-animation-thread.cpp
dali-toolkit/internal/visuals/animated-vector-image/vector-animation-thread.h

index 2f29ac0..75fa62e 100644 (file)
@@ -524,11 +524,11 @@ uint32_t VectorAnimationTask::GetStoppedFrame(uint32_t startFrame, uint32_t endF
 
 VectorAnimationTask::TimePoint VectorAnimationTask::CalculateNextFrameTime(bool renderNow)
 {
-  // std::chrono::time_point template has second parameter duration which defaults to the std::chrono::system_clock supported
+  // std::chrono::time_point template has second parameter duration which defaults to the std::chrono::steady_clock supported
   // duration. In some C++11 implementations it is a milliseconds duration, so it fails to compile unless mNextFrameStartTime
   // is casted to use the default duration.
   mNextFrameStartTime = std::chrono::time_point_cast<TimePoint::duration>(mNextFrameStartTime + std::chrono::microseconds(mFrameDurationMicroSeconds));
-  auto current        = std::chrono::system_clock::now();
+  auto current        = std::chrono::steady_clock::now();
   if(renderNow)
   {
     mNextFrameStartTime = current;
index c14cc10..3c0b8e3 100644 (file)
@@ -47,7 +47,7 @@ class VectorAnimationTask : public RefObject
 public:
   using UploadCompletedSignalType = Dali::VectorAnimationRenderer::UploadCompletedSignalType;
 
-  using TimePoint = std::chrono::time_point<std::chrono::system_clock>;
+  using TimePoint = std::chrono::time_point<std::chrono::steady_clock>;
 
   /**
    * Flags for re-sending data to the vector animation thread
index a5b1166..97634f6 100644 (file)
@@ -216,7 +216,7 @@ void VectorAnimationThread::Rasterize()
   {
     VectorAnimationTaskPtr nextTask = *it;
 
-    auto currentTime   = std::chrono::system_clock::now();
+    auto currentTime   = std::chrono::steady_clock::now();
     auto nextFrameTime = nextTask->GetNextFrameTime();
 
 #if defined(DEBUG_ENABLED)
@@ -300,7 +300,7 @@ VectorAnimationThread::SleepThread::~SleepThread()
   Join();
 }
 
-void VectorAnimationThread::SleepThread::SleepUntil(std::chrono::time_point<std::chrono::system_clock> timeToSleepUntil)
+void VectorAnimationThread::SleepThread::SleepUntil(std::chrono::time_point<std::chrono::steady_clock> timeToSleepUntil)
 {
   ConditionalWait::ScopedLock lock(mConditionalWait);
   mSleepTimePoint = timeToSleepUntil;
@@ -316,7 +316,7 @@ void VectorAnimationThread::SleepThread::Run()
   while(!mDestroyThread)
   {
     bool                                               needToSleep;
-    std::chrono::time_point<std::chrono::system_clock> sleepTimePoint;
+    std::chrono::time_point<std::chrono::steady_clock> sleepTimePoint;
 
     {
       ConditionalWait::ScopedLock lock(mConditionalWait);
@@ -330,7 +330,7 @@ void VectorAnimationThread::SleepThread::Run()
     if(needToSleep)
     {
 #if defined(DEBUG_ENABLED)
-      auto sleepDuration = std::chrono::duration_cast<std::chrono::milliseconds>(mSleepTimePoint - std::chrono::system_clock::now());
+      auto sleepDuration = std::chrono::duration_cast<std::chrono::milliseconds>(mSleepTimePoint - std::chrono::steady_clock::now());
 
       DALI_LOG_INFO(gVectorAnimationLogFilter, Debug::Verbose, "VectorAnimationThread::SleepThread::Run: [sleep duration = %lld]\n", sleepDuration.count());
 #endif
index 86fec43..8190e7b 100644 (file)
@@ -139,7 +139,7 @@ private:
     /**
      * @brief Sleeps untile the specified time point.
      */
-    void SleepUntil(std::chrono::time_point<std::chrono::system_clock> timeToSleepUntil);
+    void SleepUntil(std::chrono::time_point<std::chrono::steady_clock> timeToSleepUntil);
 
   protected:
     /**
@@ -154,7 +154,7 @@ private:
   private:
     ConditionalWait                                    mConditionalWait;
     std::unique_ptr<CallbackBase>                      mAwakeCallback;
-    std::chrono::time_point<std::chrono::system_clock> mSleepTimePoint;
+    std::chrono::time_point<std::chrono::steady_clock> mSleepTimePoint;
     const Dali::LogFactoryInterface&                   mLogFactory;
     bool                                               mNeedToSleep;
     bool                                               mDestroyThread;