mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 18:47:28 +02:00
cleanup clockSkew debug options and remove some chatty logs
This commit is contained in:
parent
6e2c0032b5
commit
5b36953e81
5 changed files with 26 additions and 16 deletions
|
@ -28,11 +28,12 @@ int main(int argc, const char * argv[]) {
|
|||
// Debug option to demonstrate that the client's local time does not
|
||||
// need to be in sync with any other network node. This forces clock
|
||||
// skew for the individual client
|
||||
const char* TIME_ADJUST = "--usecTimestampNowAdjust";
|
||||
const char* timeAdjustOption = getCmdOption(argc, argv, TIME_ADJUST);
|
||||
if (timeAdjustOption) {
|
||||
::usecTimestampNowAdjust = atoi(timeAdjustOption);
|
||||
qDebug("timeAdjustOption=%s usecTimestampNowAdjust=%d\n", timeAdjustOption, ::usecTimestampNowAdjust);
|
||||
const char* CLOCK_SKEW = "--clockSkew";
|
||||
const char* clockSkewOption = getCmdOption(argc, argv, CLOCK_SKEW);
|
||||
if (clockSkewOption) {
|
||||
int clockSkew = atoi(clockSkewOption);
|
||||
usecTimestampNowForceClockSkew(clockSkew);
|
||||
qDebug("clockSkewOption=%s clockSkew=%d\n", clockSkewOption, clockSkew);
|
||||
}
|
||||
|
||||
int exitCode;
|
||||
|
|
|
@ -660,11 +660,12 @@ void OctreeServer::run() {
|
|||
// Debug option to demonstrate that the server's local time does not
|
||||
// need to be in sync with any other network node. This forces clock
|
||||
// skew for the individual server node
|
||||
const char* TIME_ADJUST = "--usecTimestampNowAdjust";
|
||||
const char* timeAdjustOption = getCmdOption(_argc, _argv, TIME_ADJUST);
|
||||
if (timeAdjustOption) {
|
||||
::usecTimestampNowAdjust = atoi(timeAdjustOption);
|
||||
qDebug("timeAdjustOption=%s usecTimestampNowAdjust=%d\n", timeAdjustOption, ::usecTimestampNowAdjust);
|
||||
const char* CLOCK_SKEW = "--clockSkew";
|
||||
const char* clockSkewOption = getCmdOption(_argc, _argv, CLOCK_SKEW);
|
||||
if (clockSkewOption) {
|
||||
int clockSkew = atoi(clockSkewOption);
|
||||
usecTimestampNowForceClockSkew(clockSkew);
|
||||
qDebug("clockSkewOption=%s clockSkew=%d\n", clockSkewOption, clockSkew);
|
||||
}
|
||||
|
||||
// Check to see if the user passed in a command line option for setting packet send rate
|
||||
|
|
|
@ -409,11 +409,15 @@ void Particle::update() {
|
|||
bool isInHand = getInHand();
|
||||
bool shouldDie = !isInHand && !isStillMoving && isReallyOld;
|
||||
setShouldDie(shouldDie);
|
||||
|
||||
printf("Particle::update()... timeElapsed: %f lifeTime:%f editedAgo:%f isInHand:%s isStillMoveing:%s isReallyOld:%s shouldDie:%s\n",
|
||||
timeElapsed, getLifetime(), getEditedAgo(), debug::valueOf(isInHand), debug::valueOf(isStillMoving),
|
||||
debug::valueOf(isReallyOld), debug::valueOf(shouldDie));
|
||||
|
||||
bool wantDebug = false;
|
||||
if (wantDebug) {
|
||||
printf("Particle::update()... timeElapsed: %f lifeTime:%f editedAgo:%f "
|
||||
"isInHand:%s isStillMoveing:%s isReallyOld:%s shouldDie:%s\n",
|
||||
timeElapsed, getLifetime(), getEditedAgo(), debug::valueOf(isInHand), debug::valueOf(isStillMoving),
|
||||
debug::valueOf(isReallyOld), debug::valueOf(shouldDie));
|
||||
}
|
||||
|
||||
runScript(); // allow the javascript to alter our state
|
||||
|
||||
// If the ball is in hand, it doesn't move or have gravity effect it
|
||||
|
|
|
@ -31,10 +31,14 @@ uint64_t usecTimestamp(const timeval *time) {
|
|||
}
|
||||
|
||||
int usecTimestampNowAdjust = 0;
|
||||
void usecTimestampNowForceClockSkew(int clockSkew) {
|
||||
::usecTimestampNowAdjust = clockSkew;
|
||||
}
|
||||
|
||||
uint64_t usecTimestampNow() {
|
||||
timeval now;
|
||||
gettimeofday(&now, NULL);
|
||||
return (now.tv_sec * 1000000 + now.tv_usec) + usecTimestampNowAdjust;
|
||||
return (now.tv_sec * 1000000 + now.tv_usec) + ::usecTimestampNowAdjust;
|
||||
}
|
||||
|
||||
float randFloat () {
|
||||
|
|
|
@ -56,7 +56,7 @@ static const uint64_t USECS_PER_SECOND = 1000 * 1000;
|
|||
|
||||
uint64_t usecTimestamp(const timeval *time);
|
||||
uint64_t usecTimestampNow();
|
||||
extern int usecTimestampNowAdjust;
|
||||
void usecTimestampNowForceClockSkew(int clockSkew);
|
||||
|
||||
float randFloat();
|
||||
int randIntInRange (int min, int max);
|
||||
|
|
Loading…
Reference in a new issue