go-waku/waku/v2/utils/time.go
Richard Ramos c98769b7f2 refactor: use envelopes in the store
Also do some linting and add documentation for some functions
2021-11-06 09:06:53 -04:00

16 lines
499 B
Go

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