diff --git a/src/devices/video/EmuNV2A_PTIMER.cpp b/src/devices/video/EmuNV2A_PTIMER.cpp index 1cd8b6a09..758cb7e77 100644 --- a/src/devices/video/EmuNV2A_PTIMER.cpp +++ b/src/devices/video/EmuNV2A_PTIMER.cpp @@ -41,15 +41,19 @@ #include "CxbxCommon.h" +#define NANOSECONDS_PER_SECOND 1000000000 + /* PTIMER - time measurement and time-based alarms */ static uint64_t ptimer_get_clock(NV2AState * d) { // Get time in nanoseconds uint64_t time = std::chrono::duration_cast(std::chrono::high_resolution_clock::now().time_since_epoch()).count(); - return Muldiv64(time, - uint32_t(d->pramdac.core_clock_freq * d->ptimer.numerator), - CLOCKS_PER_SEC * d->ptimer.denominator); + return Muldiv64(Muldiv64(time, + d->pramdac.core_clock_freq, + NANOSECONDS_PER_SECOND), // Was CLOCKS_PER_SEC + d->ptimer.denominator, + d->ptimer.numerator); } DEVICE_READ32(PTIMER) diff --git a/src/devices/video/nv2a_int.h b/src/devices/video/nv2a_int.h index c792e49c3..29ddcc5a5 100644 --- a/src/devices/video/nv2a_int.h +++ b/src/devices/video/nv2a_int.h @@ -1753,7 +1753,7 @@ #define NV2A_VERTEX_ATTR_RESERVED2 14 #define NV2A_VERTEX_ATTR_RESERVED3 15 -#define NV2A_CRYSTAL_FREQ 13500000 +#define NV2A_CRYSTAL_FREQ 16666666 // Was 13500000 #define NV2A_NUM_CHANNELS 32 #define NV2A_NUM_SUBCHANNELS 8