mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -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", false,
|
||||
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 "
|
||||
"defined."));
|
||||
"clock against the system clock."));
|
||||
}
|
||||
|
||||
return *paranoid_clock;
|
||||
|
@ -26,15 +26,15 @@
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE double TrueClock::
|
||||
get_short_time() {
|
||||
bool paranoid_clock = _paranoid_clock;
|
||||
bool is_paranoid_clock = get_paranoid_clock();
|
||||
|
||||
if (paranoid_clock) {
|
||||
if (is_paranoid_clock) {
|
||||
_lock.lock();
|
||||
}
|
||||
|
||||
double time = get_short_raw_time();
|
||||
|
||||
if (paranoid_clock) {
|
||||
if (is_paranoid_clock) {
|
||||
// Check for rollforwards, rollbacks, and compensate for Speed
|
||||
// Gear type programs by verifying against the time of day clock.
|
||||
time = correct_time(time);
|
||||
|
@ -180,23 +180,16 @@ TrueClock() {
|
||||
// the above clocks if paranoid-clock is enabled.
|
||||
GetSystemTimeAsFileTime((FILETIME *)&_init_tod);
|
||||
|
||||
_paranoid_clock = get_paranoid_clock();
|
||||
_chase_clock = CC_keep_even;
|
||||
|
||||
if (_paranoid_clock) {
|
||||
// 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
|
||||
// just after startup.
|
||||
_timestamps.push_back(Timestamp(0.0, 0.0));
|
||||
}
|
||||
// In case 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
|
||||
// just after startup.
|
||||
_timestamps.push_back(Timestamp(0.0, 0.0));
|
||||
|
||||
if (!_has_high_res) {
|
||||
clock_cat.warning()
|
||||
<< "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 "pdeque.h"
|
||||
#include "mutexImpl.h"
|
||||
#include "config_express.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : TrueClock
|
||||
@ -79,8 +80,6 @@ protected:
|
||||
int _init_tc;
|
||||
PN_uint64 _init_tod;
|
||||
|
||||
bool _paranoid_clock;
|
||||
|
||||
// The rest of the data structures in this block are strictly for
|
||||
// implementing paranoid_clock: they are designed to allow us to
|
||||
// cross-check the high-resolution clock against the time-of-day
|
||||
|
Loading…
x
Reference in New Issue
Block a user