This looks potentially useful, thanks.
One thing I'd pick up from the README, which says:

> The Go standard library time package does not provide a user-accessible
monotonic clock.

That might have been true at one point, but is no longer the case.
See https://go.googlesource.com/proposal/+/master/design/12914-monotonic.md
for details of the
monotonic clock proposal.

In short, time.Time.Sub on timestamps derived from time.Now will give the
monotonic time interval
between them, regardless of leap seconds and the like.

So:
    t0 := time.Now()
    t1 := time.Now()
    d := t1.Sub(t0)

will guarantee that d is non-negative (assuming the underlying system
provides access to a monotonic clock).


On Sat, 24 Jan 2026 at 18:22, Jason E. Aten <[email protected]> wrote:

> I have open sourced my hybrid physical/logical clock package, here.
>
> https://github.com/glycerine/hlc
>
> HLC are useful for solving various problems in distributed systems.
>
> The concept of an HLC was invented in this 2014 paper, to combine and
> preserve the convenient features of both physical and logical clocks:
>
> "Logical Physical Clocks and Consistent Snapshots in Globally Distributed
> Databases" by Sandeep Kulkarni, Murat Demirbas, Deepak Madeppa, Bharadwaj
> Avva, and Marcelo Leone.
>
> https://cse.buffalo.edu/tech-reports/2014-04.pdf
>
> See for instance their use in CockroachDB and MongoDB as alternatives to
> Spanner's TrueTime approach when atomic clocks are unavailable.
>
> https://cse.buffalo.edu/~demirbas/publications/augmentedTime.pdf
>
> https://github.com/AugmentedTimeProject/AugmentedTimeProject
>
>
> https://muratbuffalo.blogspot.com/2025/01/use-of-time-in-distributed-databases.html
>
> Enjoy,
>
> Jason
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion visit
> https://groups.google.com/d/msgid/golang-nuts/7718c100-4382-4f87-992e-7a3839331042n%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/7718c100-4382-4f87-992e-7a3839331042n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/golang-nuts/CAJhgaci2PFnhjWO8Yr9wBVjfteGt9Gzw53BpWYyMiCfgh4K8Mw%40mail.gmail.com.

Reply via email to