Skip to content

Commit

Permalink
common/mclock: remove dependency on github.com/aristanetworks/goarista (
Browse files Browse the repository at this point in the history
  • Loading branch information
gzliudan committed Dec 26, 2024
1 parent 1359c4f commit f9ee15f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
12 changes: 8 additions & 4 deletions common/mclock/mclock.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,19 @@ package mclock
import (
"time"

"github.com/aristanetworks/goarista/monotime"
_ "unsafe" // for go:linkname
)

//go:noescape
//go:linkname nanotime runtime.nanotime
func nanotime() int64

// AbsTime represents absolute monotonic time.
type AbsTime time.Duration
type AbsTime int64

// Now returns the current absolute monotonic time.
func Now() AbsTime {
return AbsTime(monotime.Now())
return AbsTime(nanotime())
}

// Add returns t + d as absolute time.
Expand Down Expand Up @@ -74,7 +78,7 @@ type System struct{}

// Now returns the current monotonic time.
func (c System) Now() AbsTime {
return AbsTime(monotime.Now())
return Now()
}

// Sleep blocks for the given duration.
Expand Down
1 change: 1 addition & 0 deletions common/mclock/mclock.s
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// This file exists in order to be able to use go:linkname.
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ go 1.22

require (
github.com/VictoriaMetrics/fastcache v1.12.2
github.com/aristanetworks/goarista v0.0.0-20231019142648-8c6f0862ab98
github.com/btcsuite/btcd v0.0.0-20171128150713-2e60448ffcc6
github.com/cespare/cp v1.1.1
github.com/davecgh/go-spew v1.1.1
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjC
github.com/VictoriaMetrics/fastcache v1.12.2/go.mod h1:AmC+Nzz1+3G2eCPapF6UcsnkThDcMsQicp4xDukwJYI=
github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah4HI848JfFxHt+iPb26b4zyfspmqY0/8=
github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM=
github.com/aristanetworks/goarista v0.0.0-20231019142648-8c6f0862ab98 h1:7buXGE+m4OPjyo8rUJgA8RmARNMq+m99JJLR+Z+ZWN0=
github.com/aristanetworks/goarista v0.0.0-20231019142648-8c6f0862ab98/go.mod h1:DLTg9Gp4FAXF5EpqYBQnUeBbRsNLY7b2HR94TE5XQtE=
github.com/bits-and-blooms/bitset v1.5.0 h1:NpE8frKRLGHIcEzkR+gZhiioW1+WbYV6fKwD6ZIpQT8=
github.com/bits-and-blooms/bitset v1.5.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA=
github.com/btcsuite/btcd v0.0.0-20171128150713-2e60448ffcc6 h1:Eey/GGQ/E5Xp1P2Lyx1qj007hLZfbi0+CoVeJruGCtI=
Expand Down

0 comments on commit f9ee15f

Please sign in to comment.