go-chart/util/time.go
Will Charczuk 376a8efa36 updates
2017-04-29 13:19:17 -07:00

20 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))
}