mirror of
https://github.com/eosswedenorg/antelope-api-healthcheck
synced 2026-06-20 09:56:49 +02:00
Adding src/utils/time.go
This commit is contained in:
parent
c8a128b657
commit
d3d0fb11d7
2 changed files with 48 additions and 0 deletions
22
src/utils/time.go
Normal file
22
src/utils/time.go
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
|
||||
package utils
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type Time struct {
|
||||
ts time.Time
|
||||
}
|
||||
|
||||
func (t *Time) SetTime(value time.Time) {
|
||||
t.ts = value
|
||||
}
|
||||
|
||||
func (t Time) GetTime() time.Time {
|
||||
|
||||
if ! t.ts.IsZero() {
|
||||
return t.ts
|
||||
}
|
||||
return time.Now().In(time.UTC)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue