2014-06-16 16:39:25 -07:00
|
|
|
package binary
|
|
|
|
|
|
|
|
import (
|
2014-07-01 14:50:24 -07:00
|
|
|
"io"
|
|
|
|
"time"
|
2014-06-16 16:39:25 -07:00
|
|
|
)
|
|
|
|
|
2014-09-03 19:21:19 -07:00
|
|
|
// Time
|
2014-07-28 01:41:25 -07:00
|
|
|
|
2014-12-09 18:49:04 -08:00
|
|
|
func WriteTime(t time.Time, w io.Writer, n *int64, err *error) {
|
|
|
|
WriteInt64(t.UnixNano(), w, n, err)
|
2014-07-28 01:41:25 -07:00
|
|
|
}
|
|
|
|
|
2014-09-03 19:21:19 -07:00
|
|
|
func ReadTime(r io.Reader, n *int64, err *error) time.Time {
|
|
|
|
t := ReadInt64(r, n, err)
|
2014-10-07 13:39:21 -07:00
|
|
|
return time.Unix(0, t)
|
2014-06-16 16:39:25 -07:00
|
|
|
}
|