55 #if defined (__x86_64__) || defined(__i386__)
60 asm volatile (
"rdtsc" :
"=a" (low),
"=d" (high));
63 #elif defined(__PPC__) || defined(__PPC64__)
68 asm volatile (
"mftb %0" :
"=r" (ret) : );
71 #elif defined(__ia64__)
76 asm volatile (
"mov %0=ar.itc" :
"=r" (ret));
131 bool null()
const {
return fValue <= 0.; }
157 if (set_to_now) *
this = now;
227 tv_nsec = ((jsdate % 1000)*1000000);
233 SetJSDate(v > 0 ? (uint64_t) v * 1000 : 0);
237 std::string
AsString(
int ndecimal = 0,
bool localtime =
false)
const;
242 std::string
AsJSString(
int ndecimal = 3)
const;
245 std::string
OnlyDateAsString(
const char *separ =
nullptr,
bool localtime =
false)
const;
248 std::string
OnlyTimeAsString(
const char *separ =
nullptr,
bool localtime =
false)
const;
262 void Sleep(
double tm);
Class for holding GMT time with precision of nanoseconds.
DateTime(uint64_t jsdate)
DateTime(const DateTime &src)
bool SetOnlyTime(const char *sbuf)
Set only time part of DateTime.
std::string OnlyTimeAsString(const char *separ=nullptr, bool localtime=false) const
Fills only time as string.
std::string AsJSString(int ndecimal=3) const
convert string into sec.frac format, can be interpret directly in JavaScript ISO 8601 standard is use...
DateTime & operator=(const DateTime &src)
double operator-(const DateTime &src) const
double AsDouble() const
Return date and time in seconds since 1.1.1970.
void SetJSDate(uint64_t jsdate)
Set value in form of JS date - milliseconds since 1.1.1970.
uint64_t AsJSDate() const
Return date and time in JS format - number of millisecond since 1.1.1970.
std::string AsString(int ndecimal=0, bool localtime=false) const
convert string into human-readable format, cannot be interpret directly in JavaScript
unsigned AsUTCSeconds() const
Returns only seconds since 1.1.1970.
double DistanceTo(const DateTime &src) const
Return distance in seconds to provided date.
bool SetOnlyDate(const char *sbuf)
Set only date part from the string.
void SetDouble(double v)
Set value in form of double - seconds since 1.1.1970.
std::string OnlyDateAsString(const char *separ=nullptr, bool localtime=false) const
Fills only date as string.
Class for acquiring and holding timestamps.
double SpentTillNow(bool set_to_now)
Method return time in second, spent from the time kept in TimeStamp instance If specified,...
double fValue
time since start of the application in seconds
TimeStamp operator-(double _sub) const
double SpentTillNow() const
Method return time in second, spent from the time kept in TimeStamp instance If time was not set befo...
TimeStamp & operator+=(double _add)
static slowclock_t GetSlowClock()
void GetNow(double shift)
Method to acquire current time stamp plus shift in seconds.
TimeStamp(const TimeStamp &src)
static double gFastClockMult
TimeStamp & operator=(const TimeStamp &src)
bool operator==(const TimeStamp &src) const
void Reset()
Set time stamp value to null.
static double CalculateFastClockMult()
bool Expired(const TimeStamp &curr, double interval) const
Method returns true if specified time interval expired relative to time, kept in TimeStamp instance.
static bool gFast
indicates if fast or slow method is used for time measurement
static TimeStamp Now()
Method returns TimeStamp instance with current time stamp value, measured either by fast TSC (if it i...
static slowclock_t gSlowClockZero
bool Expired(double interval=0.) const
Method returns true if specified time interval expired relative to time, kept in TimeStamp instance.
static fastclock_t GetFastClock()
void GetNow()
Method to acquire current time stamp.
TimeStamp & operator-=(double _sub)
bool operator<(const TimeStamp &src) const
double AsDouble() const
Return time stamp in form of double (in seconds)
static TimeStamp Fast()
Method returns TimeStamp instance with current time, measure by fast TSC clock.
double operator()() const
static fastclock_t gFastClockZero
bool operator>(const TimeStamp &src) const
TimeStamp operator+(double _add) const
static bool CheckLinuxTSC()
double operator-(const TimeStamp &src) const
static TimeStamp Slow()
Method returns TimeStamp instance with current time, measured by 'slow' getclock() function.
long long int slowclock_t