go-waku/waku/v2/utils/time.go
Richard Ramos 58f739765e
refactor: use int64 timestamps (#189)
* refactor: use int64 timestamps
* fix: changed PB Timestamp index to 10
2022-02-23 11:01:53 -04:00

15 lines
389 B
Go

package utils
import "time"
// GetUnixEpoch converts a time into a unix timestamp with nanoseconds
func GetUnixEpochFrom(now time.Time) int64 {
return now.UnixNano()
}
// GetUnixEpoch returns the current time in unix timestamp with the integer part
// representing seconds and the decimal part representing subseconds
func GetUnixEpoch() int64 {
return GetUnixEpochFrom(time.Now())
}