1 type Alias
Three timestamp-related type aliases, Timediff represents the difference between two timestamps, the second is a timestamp in microseconds, and the third is a timestamp in 100 nanoseconds (0.1 subtle):
typedef Int64 TIMEDIFF; Difference between two timestamps in microseconds
typedef Int64 Timeval; Monotonic UTC time value in microsecond resolution
typedef Int64 Utctimeval; Monotonic UTC time value in nanosecond resolution
2 constructors
Time stamp for current time:
Timestamp ();
Time stamp for the specified time:
Timestamp (Timeval TV);
Copy constructor:
Timestamp (const timestamp& Other);
3 Overloaded Operators
Assignment operator:
timestamp& operator = (const timestamp& other);
timestamp& operator = (timeval TV);
Comparison operators:
BOOL operator = = (CONST timestamp& TS) const;
BOOL operator!= (const timestamp& TS) const;
BOOL operator > (const timestamp& TS) const;
BOOL operator >= (const timestamp& TS) const;
BOOL operator < (const timestamp& TS) const;
BOOL operator <= (const timestamp& TS) const;
Arithmetic operators and arithmetic assignment operators
Timestamp operator + (Timediff d) const;
Timestamp operator-(Timediff d) const;
Timediff operator-(const timestamp& TS) const;
timestamp& operator + = (Timediff d);
timestamp& operator-= (Timediff D);
4 getting the timestamp of different format representations
Gets the timestamp of the std::time_t format:
std::time_t epochtime () const;
Gets the timestamp of the utc-based time format:
Utctimeval utctime () const;
Gets the timestamp of the Timeval format (microseconds):
Timeval epochmicroseconds () const;
5 other member functions
Swap time stamp:
void swap (timestamp& Timestamp);
Update Timestamp is current time:
void Update ();
The difference between the time stamp and the time stamp (TimeStamp ()-*this):
TIMEDIFF elapsed () const;
To determine whether a period of time has passed:
BOOL Iselapsed (Timediff interval) const;
6 Static member functions
Create a timestamp with the std::time_t object:
Static Timestamp Fromepochtime (std::time_t t);
Create a Timestamp with the Utctimeval object:
Static Timestamp Fromutctime (Utctimeval val);
Returns the time resolution, that is, Units per second. Because the minimum resolution of the poco::timestamp is subtle, the function returns 1000000:
Static timeval resolution ();
Reprinted please the famous CSDN blog from Liuda: blog.csdn.net/poechant
View a full set of articles: Http://www.bianceng.cn/Programming/cplus/201301/35022.htm