Go to the SVN repository for this file.
1 #ifndef NST_PRECISE_TIME__HPP 2 #define NST_PRECISE_TIME__HPP 58clock_gettime(CLOCK_REALTIME, &
result);
74{ tv_sec =
int(time);
81time_t
Sec(
void)
const 89 if(tv_sec <
t.tv_sec)
91 else if(tv_sec >
t.tv_sec)
93 else if(tv_nsec <
t.tv_nsec)
95 else if(tv_nsec >
t.tv_nsec)
103tv_nsec +=
t.tv_nsec;
113 if(tv_nsec >=
t.tv_nsec) {
114tv_nsec -=
t.tv_nsec;
119tv_nsec -=
t.tv_nsec;
132 operatordouble ()
const 133{
return(
double)tv_sec + ((double)tv_nsec / (
double)
kNSecsPerSecond); }
158 returnlhs.tv_sec == rhs.tv_sec &&
159lhs.tv_nsec == rhs.tv_nsec;
166 return!(lhs == rhs);
173 CTimeconverted(
t.Sec());
178 returnconverted.
AsString() +
".0";
181sprintf(
buffer,
"%06lu", usec);
192sprintf(
buffer,
"%lu.0",
t.Sec());
196sprintf(
buffer,
"%lu.%06lu",
t.Sec(), usec);
bool operator>=(const CNSTPreciseTime &t) const
static CNSTPreciseTime Never(void)
CNSTPreciseTime & operator-=(const CNSTPreciseTime &t)
int Compare(const CNSTPreciseTime &t) const
bool operator<(const CNSTPreciseTime &t) const
CNSTPreciseTime & operator+=(const CNSTPreciseTime &t)
bool operator<=(const CNSTPreciseTime &t) const
CNSTPreciseTime(time_t sec)
CNSTPreciseTime(double time)
CNSTPreciseTime(unsigned int sec, unsigned int nsec)
static CNSTPreciseTime Current(void)
bool operator>(const CNSTPreciseTime &t) const
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
CTime & ToLocalTime(void)
Convert the time into local time.
string AsString(const CTimeFormat &format=kEmptyStr, TSeconds out_tz=eCurrentTimeZone) const
Transform time to string.
unsigned int
A callback function used to compare two keys in a database.
Defines: CTimeFormat - storage class for time format.
bool operator==(const CNSTPreciseTime &lhs, const CNSTPreciseTime &rhs)
bool operator!=(const CNSTPreciseTime &lhs, const CNSTPreciseTime &rhs)
CNSTPreciseTime operator+(const CNSTPreciseTime &lhs, const CNSTPreciseTime &rhs)
string NST_FormatPreciseTimeAsSec(const CNSTPreciseTime &t)
CNSTPreciseTime operator-(const CNSTPreciseTime &lhs, const CNSTPreciseTime &rhs)
string NST_FormatPreciseTime(const CNSTPreciseTime &t)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4