hydroflow icon indicating copy to clipboard operation
hydroflow copied to clipboard

Support for wall-clock time in Context.

Open rohitkulshreshtha opened this issue 1 year ago • 2 comments

I need wall clock time for a HLC implementation.

The current implementation of Context:: current_tick_start uses std::time::instant as the type.

Should we add another field to represent wall clock time? Or should we replace current_tick_start with SystemTime?

Arguments for changing type:

  • Individual clock readings in the context are all meaningful, without the need for another timestamp. It can be used to stamp messages and events.

Arguments for keeping type (and introducing a separate field for wall clock time)

  • It helps measure the performance of operations since the start of the tick, although one can do this in other ways.

IMHO, changing the type makes more sense.

rohitkulshreshtha avatar May 07 '24 21:05 rohitkulshreshtha

What do you need that Instant can't provide? Serialization/deserialization?

MingweiSamuel avatar May 07 '24 21:05 MingweiSamuel

For Hybrid-Logical clock? I need the wall clock time. Instant is not wall clock time - it's an offset from some arbitrary event, and systems may not even agree on the "start" for measuring the offset.

For example, on Windows, instant uses QueryPerformanceCounter APIs. This is what the documentation says about the value:

QPC is independent of, and isn't synchronized to, any external time reference. To retrieve time stamps that can be synchronized to an external time reference, such as, Coordinated Universal Time (UTC) for use in high-resolution time-of-day measurements, use GetSystemTimePreciseAsFileTime.

rohitkulshreshtha avatar May 07 '24 22:05 rohitkulshreshtha

Fixed. https://github.com/hydro-project/hydroflow/pull/1196

For the future: https://github.com/hydro-project/hydroflow/issues/1202

rohitkulshreshtha avatar May 17 '24 20:05 rohitkulshreshtha