Changeset 8127 in ntrip for trunk/BNC/qwt/qwt_system_clock.cpp
- Timestamp:
- May 10, 2017, 3:20:54 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/qwt/qwt_system_clock.cpp
r4271 r8127 9 9 10 10 #include "qwt_system_clock.h" 11 12 #if QT_VERSION >= 0x040800 13 #define USE_ELAPSED_TIMER 1 14 #endif 15 16 #if USE_ELAPSED_TIMER 17 18 #include <qelapsedtimer.h> 19 20 class QwtSystemClock::PrivateData 21 { 22 public: 23 QElapsedTimer timer; 24 }; 25 26 QwtSystemClock::QwtSystemClock() 27 { 28 d_data = new PrivateData(); 29 } 30 31 QwtSystemClock::~QwtSystemClock() 32 { 33 delete d_data; 34 } 35 36 bool QwtSystemClock::isNull() const 37 { 38 return d_data->timer.isValid(); 39 } 40 41 void QwtSystemClock::start() 42 { 43 d_data->timer.start(); 44 } 45 46 double QwtSystemClock::restart() 47 { 48 const qint64 nsecs = d_data->timer.restart(); 49 return nsecs / 1e6; 50 } 51 52 double QwtSystemClock::elapsed() const 53 { 54 const qint64 nsecs = d_data->timer.nsecsElapsed(); 55 return nsecs / 1e6; 56 } 57 58 #else // !USE_ELAPSED_TIMER 59 11 60 #include <qdatetime.h> 12 61 … … 111 160 kern_return_t err = mach_timebase_info( &info ); 112 161 113 // Convert the timebase into ms162 // convert the timebase into ms 114 163 if ( err == 0 ) 115 164 conversion = 1e-6 * ( double ) info.numer / ( double ) info.denom; … … 308 357 309 358 /*! 310 The start time to the current time and 311 return the time, that is elapsed since the 312 previous start time. 359 Set the start time to the current time 360 \return Time, that is elapsed since the previous start time. 313 361 */ 314 362 double QwtSystemClock::restart() … … 346 394 } 347 395 348 /*! 349 \return Accuracy of the system clock in milliseconds. 350 */ 351 double QwtSystemClock::precision() 352 { 353 static double prec = 0.0; 354 if ( prec <= 0.0 ) 355 { 356 #if defined(QWT_HIGH_RESOLUTION_CLOCK) 357 prec = QwtHighResolutionClock::precision(); 358 #endif 359 if ( prec <= 0.0 ) 360 prec = 1.0; // QTime offers 1 ms 361 } 362 363 return prec; 364 } 396 #endif
Note:
See TracChangeset
for help on using the changeset viewer.