HDFGroup / hsds

Cloud-native, service based access to HDF data
https://www.hdfgroup.org/solutions/hdf-kita/
Apache License 2.0
129 stars 53 forks source link

Creation timestamps lack resolution on Windows #344

Closed mattjala closed 6 months ago

mattjala commented 6 months ago

time.time() is used to get the current time when creating a link or other object. This works fine on POSIX systems, but on Windows only has a precision of about ~16ms. This means that two subsequently created objects can have the same creation time. Sorting links by creation order no longer consistently returns the link that was actually created first.

This issue shows up when testing H5Lget_link_name_by_idx through the REST VOL on Windows - see here.

We could potentially use an external library for getting the UNIX time to have enough precision on all systems.

jreadey commented 6 months ago

What does the HDF5 library do on Windows?

mattjala commented 6 months ago

The library tries to use more precise time functions (clock_gettime, gettimeofday) before falling back to time.

I'm working on a PR which uses time.perf_counter() to make sure subsequent calls have different timestamps