Mercurial > hg > beaglert
comparison core/VirtualClock.cpp @ 152:8f98b32d0e23 ClockSync
Last commit on this branch for a while. Overall not very succesful
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Mon, 05 Oct 2015 13:06:14 +0100 |
parents | ebbfb154351a |
children |
comparison
equal
deleted
inserted
replaced
151:e9c9404e3d1f | 152:8f98b32d0e23 |
---|---|
78 #endif | 78 #endif |
79 return now; | 79 return now; |
80 } | 80 } |
81 | 81 |
82 void VirtualClock::addOffset(double periodOffset){ | 82 void VirtualClock::addOffset(double periodOffset){ |
83 // printf("Clock was : %f ", elapsedPeriods); | |
83 elapsedPeriods-=periodOffset; | 84 elapsedPeriods-=periodOffset; |
84 if(elapsedPeriods<0){ | 85 if(elapsedPeriods<0){ |
85 printf("ERROR: periodOffset adjustment of %f resulted in elapsedPeriods=%f\n", periodOffset, elapsedPeriods); | 86 printf("ERROR: periodOffset adjustment of %f resulted in elapsedPeriods=%f\n", periodOffset, elapsedPeriods); |
86 exit(1); | 87 exit(1); |
87 } | 88 } |
89 // printf("and now is: %f after a correction of %f", elapsedPeriods, periodOffset); | |
88 movingAverage.reset(); | 90 movingAverage.reset(); |
89 } | 91 } |
90 double VirtualClock::getPeriod(){ | 92 double VirtualClock::getPeriod(){ |
91 return blockPeriod; | 93 return blockPeriod; |
92 } | 94 } |