Hi folks, I am trying to get myself oriented in tracking time in qpid proton (and qpid dispatch). There is a variety of c types used for this purpose:
int64_t, uint64_t, pn_timestamp_t (int64_t), pn_millis_t (unit32_t) qd_timestamp_t (int64_t), qd_duration_t (int64_t) pn_timestamp_t is for AMQP timestamps, so the use is clear to me and the underlying type cannot be anything else than int64_t because the spec says so. Regarding the remaining types, it is not clear to me 1) when to use plain c type and when to use one of the typedefs, especially pn_millis_t and qd_timestamp_t 2) what is the rationale in making choice between 32bit and 64bit integer, 3) when to use signed and when unsigned type. Specifically, lets say for storing value of monotonic clock counting in milliseconds. It is clear I want 64bit type, because 32bits overflow in 48 days of uptime. Now about sign, proton currently variously uses both int64_t and uint64_t, maybe because libuv has uint64_t as return value for uv_now(), etc. Unsigned types can be generally tricky in some ways (which should be justification why Java does not have them) and it is reasonable to have negative differences between timestamps. Which argues for signed type for me. Then again, doing the conversions, like storing result of uv_now() to int64_t would feel "dirty" to me... And then I find pn_proactor_now(), which currently returns pn_millis_t, which is 32bit type. -- Mit freundlichen Grüßen / Kind regards Jiri Daněk
