Open danlentz opened 2 months ago
well, ok, the sleep 0.0001
in your loop probably helps avoid this happening in practice for single threaded. (and we're not worrying about multiple threads here). But, anyways, just passing along the experience, as it was a tricky one to figure out.
Just asking out of curiosity, as when working updating clj-uuid for rfc-9562 I noticed that, even in a single thread, I could generate enough calls that I would eventually receive out-of-order clock times.
https://github.com/dardoria/uuid/blob/f0052f34a006ec995086aa3b2e42182a178fe228/uuid.lisp#L143
if so, mitigating this would require just a small additional clause:
Similarly to here https://github.com/danlentz/clj-uuid/blob/master/src/clj_uuid/clock.clj#L68
Cheers!