tendermint/binary/time.go

18 lines
270 B
Go
Raw Normal View History

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
)
// Time
func WriteTime(t time.Time, w io.Writer, n *int64, err *error) {
WriteInt64(t.UnixNano(), w, n, err)
}
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
}