0
Answered

DDS Time_t origin, range?

Bradford Needham 10 years ago in DDS updated by Jeff Plourde 10 years ago 3
The RTI DDS documentation for Time_t simply states that it represents "a moment in time". It doesn't document an origin or range. What is the origin and range for this field? I ask because I want to know when it will rollover, and how to convert to/from Linux seconds-from-the-epoch.

The constructor takes an int seconds, and Java defines the default int to be signed 32 bits. From a quick calculation, that number will overflow in about 68 years from the origin.

Any idea what the origin for DDS Time_t is?

Thanks,
Brad
GOOD, I'M SATISFIED
Satisfaction mark by Bradford Needham 10 years ago
Under review
Hi Brad

To the best of my knowledge it's similar to POSIX struct timespec. So you're absolutely correct that the signed 32 bits since the UNIX epoch means it inherits the year 2038 problem. For Time_t as it is used by DDS (mainly in SampleInfo) a monotonic clock might eventually be preferable; although it could be confusing that "Time_t" encodes only a counter if configured that way. A discussion of monotonic versus realtime clock usage appears in RTI's documentation. The availability of the monotonic clock is platform-specific

The Time_t defined in ice.idl (used in device_time and presentation_time) could be changed at the "OpenICE" level. We could easily convert the seconds component to a 'long long' 64-bit value in a later version of OpenICE for the benefit of our descendants in 2038. I think this makes sense. What do you think?

Thank you
Jeff
Thanks for the answer. As to expanding Time_t to contain a 64-bit number of seconds, now that I've thought about it a bit it's probably better to leave it as a range that will remain compatible with C++ and with DDS.