23 std::numeric_limits<time_t>::max(),
27 ACE_ONE_SECOND_IN_USECS - 1);
30 time_t usec_to_rounded_frac(
31 suseconds_t
value,
unsigned decimal_places, time_t& carry)
33 const double frac =
static_cast<double>(
value) / ACE_ONE_SECOND_IN_USECS;
34 const double denominator = std::pow(10.0, static_cast<double>(decimal_places));
35 const double numerator = std::floor(frac * denominator + 0.5);
36 if (numerator == denominator) {
41 return static_cast<time_t
>(numerator);
44 String to_zero_pad_str(time_t value,
unsigned len = 2)
47 if (len > nopad.size()) {
48 return String(len - nopad.size(),
'0') + nopad;
59 bool negative =
false;
72 const time_t numerator = usec_to_rounded_frac(usec, decimal_places, carry);
73 const time_t seconds_total = sec + carry;
74 const time_t minutes_total = seconds_total / 60;
75 just_sec = just_sec || minutes_total == 0;
79 const time_t seconds = seconds_total % 60;
80 const time_t minutes = minutes_total % 60;
81 const time_t hours = minutes_total / 60;
87 rv +=
":" + to_zero_pad_str(seconds);
89 if (decimal_places > 0) {
90 rv +=
"." + to_zero_pad_str(numerator, decimal_places);
103 #if !defined (__ACE_INLINE__) const LogLevel::Value value
String to_dds_string(unsigned short to_convert)
const ACE_Time_Value & value() const
static const TimeDuration zero_value
suseconds_t usec(void) const
String str(unsigned decimal_places=3, bool just_sec=false) const
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
The Internal API and Implementation of OpenDDS.
static const TimeDuration max_value