mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-05 03:15:07 -04:00
possible fixes for paranoid-clock on publish
This commit is contained in:
parent
0680a3d796
commit
c78e9f4597
@ -192,8 +192,7 @@ get_paranoid_clock() {
|
|||||||
paranoid_clock = new ConfigVariableBool
|
paranoid_clock = new ConfigVariableBool
|
||||||
("paranoid-clock", false,
|
("paranoid-clock", false,
|
||||||
PRC_DESC("Set this to true to double-check the results of the high-resolution "
|
PRC_DESC("Set this to true to double-check the results of the high-resolution "
|
||||||
"clock against the system clock. This has no effect if NDEBUG is "
|
"clock against the system clock."));
|
||||||
"defined."));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return *paranoid_clock;
|
return *paranoid_clock;
|
||||||
|
@ -26,15 +26,15 @@
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE double TrueClock::
|
INLINE double TrueClock::
|
||||||
get_short_time() {
|
get_short_time() {
|
||||||
bool paranoid_clock = _paranoid_clock;
|
bool is_paranoid_clock = get_paranoid_clock();
|
||||||
|
|
||||||
if (paranoid_clock) {
|
if (is_paranoid_clock) {
|
||||||
_lock.lock();
|
_lock.lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
double time = get_short_raw_time();
|
double time = get_short_raw_time();
|
||||||
|
|
||||||
if (paranoid_clock) {
|
if (is_paranoid_clock) {
|
||||||
// Check for rollforwards, rollbacks, and compensate for Speed
|
// Check for rollforwards, rollbacks, and compensate for Speed
|
||||||
// Gear type programs by verifying against the time of day clock.
|
// Gear type programs by verifying against the time of day clock.
|
||||||
time = correct_time(time);
|
time = correct_time(time);
|
||||||
|
@ -180,23 +180,16 @@ TrueClock() {
|
|||||||
// the above clocks if paranoid-clock is enabled.
|
// the above clocks if paranoid-clock is enabled.
|
||||||
GetSystemTimeAsFileTime((FILETIME *)&_init_tod);
|
GetSystemTimeAsFileTime((FILETIME *)&_init_tod);
|
||||||
|
|
||||||
_paranoid_clock = get_paranoid_clock();
|
|
||||||
_chase_clock = CC_keep_even;
|
_chase_clock = CC_keep_even;
|
||||||
|
|
||||||
if (_paranoid_clock) {
|
// In case we'll be cross-checking the clock, we'd better start out
|
||||||
// If we'll be cross-checking the clock, we'd better start out
|
|
||||||
// with at least one timestamp, so we'll know if the clock jumps
|
// with at least one timestamp, so we'll know if the clock jumps
|
||||||
// just after startup.
|
// just after startup.
|
||||||
_timestamps.push_back(Timestamp(0.0, 0.0));
|
_timestamps.push_back(Timestamp(0.0, 0.0));
|
||||||
}
|
|
||||||
|
|
||||||
if (!_has_high_res) {
|
if (!_has_high_res) {
|
||||||
clock_cat.warning()
|
clock_cat.warning()
|
||||||
<< "No high resolution clock available." << endl;
|
<< "No high resolution clock available." << endl;
|
||||||
|
|
||||||
} else if (_paranoid_clock) {
|
|
||||||
clock_cat.info()
|
|
||||||
<< "Not trusting the high resolution clock." << endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include "typedef.h"
|
#include "typedef.h"
|
||||||
#include "pdeque.h"
|
#include "pdeque.h"
|
||||||
#include "mutexImpl.h"
|
#include "mutexImpl.h"
|
||||||
|
#include "config_express.h"
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Class : TrueClock
|
// Class : TrueClock
|
||||||
@ -79,8 +80,6 @@ protected:
|
|||||||
int _init_tc;
|
int _init_tc;
|
||||||
PN_uint64 _init_tod;
|
PN_uint64 _init_tod;
|
||||||
|
|
||||||
bool _paranoid_clock;
|
|
||||||
|
|
||||||
// The rest of the data structures in this block are strictly for
|
// The rest of the data structures in this block are strictly for
|
||||||
// implementing paranoid_clock: they are designed to allow us to
|
// implementing paranoid_clock: they are designed to allow us to
|
||||||
// cross-check the high-resolution clock against the time-of-day
|
// cross-check the high-resolution clock against the time-of-day
|
||||||
|
Loading…
x
Reference in New Issue
Block a user