fix macOS timer bug

This commit is contained in:
2026-06-03 17:49:21 +08:00
parent a2af4b5bf6
commit f731470c0f
2 changed files with 4 additions and 4 deletions
+2 -3
View File
@@ -21,7 +21,6 @@
#include "viewerplaybacktimer.h"
#include <QDateTime>
#include <QtMath>
namespace olive
@@ -31,7 +30,7 @@ void ViewerPlaybackTimer::Start(const int64_t &start_timestamp,
const int &playback_speed,
const double &timebase)
{
start_msec_ = QDateTime::currentMSecsSinceEpoch();
timer_.start();
start_timestamp_ = start_timestamp;
playback_speed_ = playback_speed;
timebase_ = timebase * 1000;
@@ -39,7 +38,7 @@ void ViewerPlaybackTimer::Start(const int64_t &start_timestamp,
int64_t ViewerPlaybackTimer::GetTimestampNow() const
{
int64_t real_time = QDateTime::currentMSecsSinceEpoch() - start_msec_;
int64_t real_time = timer_.elapsed();
int64_t frames_since_start =
qFloor(static_cast<double>(real_time) / (timebase_));
+2 -1
View File
@@ -23,6 +23,7 @@
#define VIEWERPLAYBACKTIMER_H
#include <QtGlobal>
#include <QElapsedTimer>
#include "common/define.h"
@@ -37,7 +38,7 @@ public:
int64_t GetTimestampNow() const;
private:
qint64 start_msec_;
QElapsedTimer timer_;
int64_t start_timestamp_;
int playback_speed_;