Files
go-i2p/lib/common/date.go

20 lines
371 B
Go
Raw Normal View History

2016-02-04 00:07:09 -08:00
package common
import (
"time"
)
type Date [8]byte
2016-02-06 01:42:47 -08:00
//
// Time takes the value stored in date as an 8
// byte big-endian integer representing the
// number of milliseconds since the beginning
// of unix time and converts it to a go time.Time
// struct.
//
2016-02-04 01:14:49 -08:00
func (date Date) Time() time.Time {
2016-02-04 00:54:51 -08:00
seconds := Integer(date[:])
2016-02-04 00:07:09 -08:00
return time.Unix(0, int64(seconds*1000000))
}