diff options
Diffstat (limited to 'Alc/backends/base.h')
-rw-r--r-- | Alc/backends/base.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Alc/backends/base.h b/Alc/backends/base.h index 61b71a47..db2127ef 100644 --- a/Alc/backends/base.h +++ b/Alc/backends/base.h @@ -7,6 +7,9 @@ #include <mutex> struct ClockLatency { + /* FIXME: These should be nanoseconds. Will require changing backends that + * provide this info. + */ ALint64 ClockTime; ALint64 Latency; }; @@ -16,8 +19,12 @@ struct ClockLatency { */ inline ALuint64 GetDeviceClockTime(ALCdevice *device) { - return device->ClockBase + (device->SamplesDone * DEVICE_CLOCK_RES / - device->Frequency); + 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(); } void ALCdevice_Lock(ALCdevice *device); |