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

19 lines
390 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
//
2016-02-14 22:40:29 -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
2016-02-06 01:42:47 -08:00
// struct.
//
2016-02-14 22:40:29 -08:00
func (date Date) Time() (date_time time.Time) {
2016-02-04 00:54:51 -08:00
seconds := Integer(date[:])
2016-02-14 22:40:29 -08:00
date_time = time.Unix(0, int64(seconds*1000000))
return
2016-02-04 00:07:09 -08:00
}