mirror of
https://github.com/cedar2025/hysteria.git
synced 2025-07-21 18:38:01 +00:00
.github
app
core
client
errors
internal
congestion
frag
integration_tests
pmtud
protocol
utils
atomic.go
qstream.go
server
go.mod
go.sum
extras
media-kit
scripts
.gitignore
CHANGELOG.md
Dockerfile
LICENSE.md
PROTOCOL.md
README.md
go.work
go.work.sum
hyperbole.py
logo.svg
platforms.txt
25 lines
316 B
Go
25 lines
316 B
Go
package utils
|
|
|
|
import (
|
|
"sync/atomic"
|
|
"time"
|
|
)
|
|
|
|
type AtomicTime struct {
|
|
v atomic.Value
|
|
}
|
|
|
|
func NewAtomicTime(t time.Time) *AtomicTime {
|
|
a := &AtomicTime{}
|
|
a.Set(t)
|
|
return a
|
|
}
|
|
|
|
func (t *AtomicTime) Set(new time.Time) {
|
|
t.v.Store(new)
|
|
}
|
|
|
|
func (t *AtomicTime) Get() time.Time {
|
|
return t.v.Load().(time.Time)
|
|
}
|