diff options
author | Chris Robinson <[email protected]> | 2018-11-22 14:32:48 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-11-22 14:32:48 -0800 |
commit | d26b5d94677a7091d95972cbfd4337fb36a5e622 (patch) | |
tree | ea4a4a6133be65473914082ed314e4ea98dc20ef /Alc/backends/base.h | |
parent | 84f0f74d0794b38d1b1bb0021090d50f2648e0ce (diff) |
Use proper time types for the device clock time and latency
Diffstat (limited to 'Alc/backends/base.h')
-rw-r--r-- | Alc/backends/base.h | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/Alc/backends/base.h b/Alc/backends/base.h index db2127ef..f4de5176 100644 --- a/Alc/backends/base.h +++ b/Alc/backends/base.h @@ -3,28 +3,26 @@ #include "alMain.h" +#include <chrono> #include <string> #include <mutex> struct ClockLatency { - /* FIXME: These should be nanoseconds. Will require changing backends that - * provide this info. - */ - ALint64 ClockTime; - ALint64 Latency; + std::chrono::nanoseconds ClockTime; + std::chrono::nanoseconds Latency; }; /* Helper to get the current clock time from the device's ClockBase, and * SamplesDone converted from the sample rate. */ -inline ALuint64 GetDeviceClockTime(ALCdevice *device) +inline std::chrono::nanoseconds GetDeviceClockTime(ALCdevice *device) { using std::chrono::seconds; using std::chrono::nanoseconds; using std::chrono::duration_cast; auto ns = duration_cast<nanoseconds>(seconds{device->SamplesDone}) / device->Frequency; - return (device->ClockBase + ns).count(); + return device->ClockBase + ns; } void ALCdevice_Lock(ALCdevice *device); |