mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 15:58:35 +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
|
// 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
|
// need to be in sync with any other network node. This forces clock
|
||||||
// skew for the individual client
|
// skew for the individual client
|
||||||
const char* TIME_ADJUST = "--usecTimestampNowAdjust";
|
const char* CLOCK_SKEW = "--clockSkew";
|
||||||
const char* timeAdjustOption = getCmdOption(argc, argv, TIME_ADJUST);
|
const char* clockSkewOption = getCmdOption(argc, argv, CLOCK_SKEW);
|
||||||
if (timeAdjustOption) {
|
if (clockSkewOption) {
|
||||||
::usecTimestampNowAdjust = atoi(timeAdjustOption);
|
int clockSkew = atoi(clockSkewOption);
|
||||||
qDebug("timeAdjustOption=%s usecTimestampNowAdjust=%d\n", timeAdjustOption, ::usecTimestampNowAdjust);
|
usecTimestampNowForceClockSkew(clockSkew);
|
||||||
|
qDebug("clockSkewOption=%s clockSkew=%d\n", clockSkewOption, clockSkew);
|
||||||
}
|
}
|
||||||
|
|
||||||
int exitCode;
|
int exitCode;
|
||||||
|
|
|
@ -660,11 +660,12 @@ void OctreeServer::run() {
|
||||||
// Debug option to demonstrate that the server's local time does not
|
// 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
|
// need to be in sync with any other network node. This forces clock
|
||||||
// skew for the individual server node
|
// skew for the individual server node
|
||||||
const char* TIME_ADJUST = "--usecTimestampNowAdjust";
|
const char* CLOCK_SKEW = "--clockSkew";
|
||||||
const char* timeAdjustOption = getCmdOption(_argc, _argv, TIME_ADJUST);
|
const char* clockSkewOption = getCmdOption(_argc, _argv, CLOCK_SKEW);
|
||||||
if (timeAdjustOption) {
|
if (clockSkewOption) {
|
||||||
::usecTimestampNowAdjust = atoi(timeAdjustOption);
|
int clockSkew = atoi(clockSkewOption);
|
||||||
qDebug("timeAdjustOption=%s usecTimestampNowAdjust=%d\n", timeAdjustOption, ::usecTimestampNowAdjust);
|
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
|
// 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 isInHand = getInHand();
|
||||||
bool shouldDie = !isInHand && !isStillMoving && isReallyOld;
|
bool shouldDie = !isInHand && !isStillMoving && isReallyOld;
|
||||||
setShouldDie(shouldDie);
|
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
|
runScript(); // allow the javascript to alter our state
|
||||||
|
|
||||||
// If the ball is in hand, it doesn't move or have gravity effect it
|
// 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;
|
int usecTimestampNowAdjust = 0;
|
||||||
|
void usecTimestampNowForceClockSkew(int clockSkew) {
|
||||||
|
::usecTimestampNowAdjust = clockSkew;
|
||||||
|
}
|
||||||
|
|
||||||
uint64_t usecTimestampNow() {
|
uint64_t usecTimestampNow() {
|
||||||
timeval now;
|
timeval now;
|
||||||
gettimeofday(&now, NULL);
|
gettimeofday(&now, NULL);
|
||||||
return (now.tv_sec * 1000000 + now.tv_usec) + usecTimestampNowAdjust;
|
return (now.tv_sec * 1000000 + now.tv_usec) + ::usecTimestampNowAdjust;
|
||||||
}
|
}
|
||||||
|
|
||||||
float randFloat () {
|
float randFloat () {
|
||||||
|
|
|
@ -56,7 +56,7 @@ static const uint64_t USECS_PER_SECOND = 1000 * 1000;
|
||||||
|
|
||||||
uint64_t usecTimestamp(const timeval *time);
|
uint64_t usecTimestamp(const timeval *time);
|
||||||
uint64_t usecTimestampNow();
|
uint64_t usecTimestampNow();
|
||||||
extern int usecTimestampNowAdjust;
|
void usecTimestampNowForceClockSkew(int clockSkew);
|
||||||
|
|
||||||
float randFloat();
|
float randFloat();
|
||||||
int randIntInRange (int min, int max);
|
int randIntInRange (int min, int max);
|
||||||
|
|
Loading…
Reference in a new issue