MIRA
|
For a general reference, the documentation http://www.boost.org/doc/libs/1_44_0/doc/html/date_time/posix_time.html can be used, since boost::posix_time::ptime and boost::posix_time::time_duration are the underlying classes of Time and Duration. However, there are some minor differences and additions to the ptime class.
The time class is used to represent a certain point in time. There are multiple ways of creating Time objects.
To obtain the current system time, call Time::now().
For conversion of Time from and to unix timestamp, use toUnixTimestamp() and fromUnixTimestamp(). Please note that the returned timestamp of toUnixTimestamp() is in seconds. Therefore, fromUnixTimestamp() also requires a timestamp with second resolution.
To use the full resolution one can turn a Time object into nanoseconds since 00:00:00-1970/01/01.
You can also create an invalid time or a representation for eternity, if necessary.
Time durations can be used to describe a length of time. The Duration class provides several ways for easy Duration object creation ranging from hours to nanoseconds.
Like Time, Durations can also be invalid.
There are multiple ways of combining Time and Duration objects in equations.
Time objects can be converted to other time zones. By default, a time object represents a timestamp in UTC time.
To convert the time to timestamps in other time zones, the following methods can be used: