Posix Time (original) (raw)

long hours()

Get the number of normalized hours (will give unpredictable results if calling time_duration is a special_value).

time_duration td(1,2,3); time_duration neg_td(-1,2,3); td.hours(); // --> 1 neg_td.hours(); // --> -1

long minutes()

Get the number of minutes normalized +/-(0..59) (will give unpredictable results if calling time_duration is a special_value).

time_duration td(1,2,3); time_duration neg_td(-1,2,3); td.minutes(); // --> 2 neg_td.minutes(); // --> -2

long seconds()

Get the normalized number of second +/-(0..59) (will give unpredictable results if calling time_duration is a special_value).

time_duration td(1,2,3); time_duration neg_td(-1,2,3); td.seconds(); // --> 3 neg_td.seconds(); // --> -3

long total_seconds()

Get the total number of seconds truncating any fractional seconds (will give unpredictable results if calling time_duration is a special_value).

time_duration td(1,2,3,10); td.total_seconds(); // --> (13600) + (260) + 3 == 3723

long total_milliseconds()

Get the total number of milliseconds truncating any remaining digits (will give unpredictable results if calling time_duration is a special_value).

time_duration td(1,2,3,123456789); td.total_milliseconds(); // HMS --> (13600) + (260) + 3 == 3723 seconds // milliseconds is 3 decimal places // (3723 * 1000) + 123 == 3723123

long total_microseconds()

Get the total number of microseconds truncating any remaining digits (will give unpredictable results if calling time_duration is a special_value).

time_duration td(1,2,3,123456789); td.total_microseconds(); // HMS --> (13600) + (260) + 3 == 3723 seconds // microseconds is 6 decimal places // (3723 * 1000000) + 123456 == 3723123456

long total_nanoseconds()

Get the total number of nanoseconds truncating any remaining digits (will give unpredictable results if calling time_duration is a special_value).

time_duration td(1,2,3,123456789); td.total_nanoseconds(); // HMS --> (13600) + (260) + 3 == 3723 seconds // nanoseconds is 9 decimal places // (3723 * 1000000000) + 123456789 // == 3723123456789

long fractional_seconds()

Get the number of fractional seconds (will give unpredictable results if calling time_duration is a special_value).

time_duration td(1,2,3, 1000); td.fractional_seconds(); // --> 1000

bool is_negative()

True if duration is negative.

time_duration td(-1,0,0); td.is_negative(); // --> true

time_duration invert_sign()

Generate a new duration with the sign inverted/

time_duration td(-1,0,0); td.invert_sign(); // --> 01:00:00

date_time::time_resolutions resolution()

Describes the resolution capability of the time_duration class. time_resolutions is an enum of resolution possibilities ranging from seconds to nanoseconds.

time_duration::resolution() --> nano

time_duration::num_fractional_digits()

Returns an unsigned short holding the number of fractional digits the time resolution has.

unsigned short secs; secs = time_duration::num_fractional_digits(); // 9 for nano, 6 for micro, etc.

time_duration::ticks_per_second()

Return the number of ticks in a second. For example, if the duration supports nanoseconds then the returned result will be 1,000,000,000 (1e+9).

std::cout << time_duration::ticks_per_second();

boost::int64_t ticks()

Return the raw count of the duration type (will give unpredictable results if calling time_duration is a special_value).

time_duration td(0,0,0, 1000); td.ticks() // --> 1000

time_duration unit()

Return smallest possible unit of duration type (1 nanosecond).

time_duration::unit() --> time_duration(0,0,0,1)

bool is_neg_infinity() const

Returns true if time_duration is negative infinity

time_duration td(neg_infin); td.is_neg_infinity(); // --> true

bool is_pos_infinity() const

Returns true if time_duration is positive infinity

time_duration td(pos_infin); td.is_pos_infinity(); // --> true

bool is_not_a_date_time() const

Returns true if value is not a time

time_duration td(not_a_date_time); td.is_not_a_date_time(); // --> true

bool is_special() const

Returns true if time_duration is any special_value

time_duration td(pos_infin); time_duration td2(not_a_date_time); time_duration td3(2,5,10); td.is_special(); // --> true td2.is_special(); // --> true td3.is_special(); // --> false