20 #include "mongo/client/export_macros.h"
37 static const long long millisPerSecond = 1000;
38 static const long long microsPerSecond = 1000 * millisPerSecond;
39 static const long long nanosPerSecond = 1000 * microsPerSecond;
45 return (
int)(micros() / 1000000);
48 return (
int)(micros() / 1000);
51 return seconds() / 60;
59 const long long nextNow = now();
60 const long long deltaMicros =
static_cast<long long>((nextNow - _old) * _microsPerCount);
63 return static_cast<int>(deltaMicros / 1000);
66 inline long long micros()
const {
67 return static_cast<long long>((now() - _old) * _microsPerCount);
74 inline static void setCountsPerSecond(
long long countsPerSecond) {
75 _countsPerSecond = countsPerSecond;
76 _microsPerCount =
static_cast<double>(microsPerSecond) / _countsPerSecond;
79 inline static long long getCountsPerSecond() {
80 return _countsPerSecond;
89 static long long _countsPerSecond;
93 static double _microsPerCount;
95 long long now()
const;
int millisReset()
Get the time interval and reset at the same time.
Definition: timer.h:58
Utility functions for parsing numbers from strings.
Definition: compare_numbers.h:20
Time tracking object.
Definition: timer.h:35