03708a90ef
* api cleaup * updates * wtf * updates * snapshot. * tweaks * snapshot * api tweaks. * updates * updates * updates * changes. * updates * updates * sequence => seq * dont need to use curl, just using wget * fixing examples
21 lines
406 B
Go
21 lines
406 B
Go
package util
|
|
|
|
import "time"
|
|
|
|
var (
|
|
// Time contains time utility functions.
|
|
Time = timeUtil{}
|
|
)
|
|
|
|
type timeUtil struct{}
|
|
|
|
// TimeToFloat64 returns a float64 representation of a time.
|
|
func (tu timeUtil) ToFloat64(t time.Time) float64 {
|
|
return float64(t.UnixNano())
|
|
}
|
|
|
|
// Float64ToTime returns a time from a float64.
|
|
func (tu timeUtil) FromFloat64(tf float64) time.Time {
|
|
return time.Unix(0, int64(tf))
|
|
}
|