/usr/share/gocode/src/github.com/tendermint/go-wire/time.go is in golang-github-tendermint-go-wire-dev 0~20161027~0git287d8ca-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | package wire
import (
"io"
"time"
. "github.com/tendermint/go-common"
)
/*
Writes nanoseconds since epoch but with millisecond precision.
This is to ease compatibility with Javascript etc.
*/
func WriteTime(t time.Time, w io.Writer, n *int, err *error) {
nanosecs := t.UnixNano()
millisecs := nanosecs / 1000000
WriteInt64(millisecs*1000000, w, n, err)
}
func ReadTime(r io.Reader, n *int, err *error) time.Time {
t := ReadInt64(r, n, err)
if t%1000000 != 0 {
PanicSanity("Time cannot have sub-millisecond precision")
}
return time.Unix(0, t)
}
|