diff options
Diffstat (limited to 'swarm/storage/feed/timestampprovider.go')
-rw-r--r-- | swarm/storage/feed/timestampprovider.go | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/swarm/storage/feed/timestampprovider.go b/swarm/storage/feed/timestampprovider.go index 072dc3a48..fb60cea9c 100644 --- a/swarm/storage/feed/timestampprovider.go +++ b/swarm/storage/feed/timestampprovider.go @@ -17,7 +17,6 @@ package feed import ( - "encoding/binary" "encoding/json" "time" ) @@ -30,32 +29,11 @@ type Timestamp struct { Time uint64 `json:"time"` // Unix epoch timestamp, in seconds } -// 8 bytes uint64 Time -const timestampLength = 8 - // timestampProvider interface describes a source of timestamp information type timestampProvider interface { Now() Timestamp // returns the current timestamp information } -// binaryGet populates the timestamp structure from the given byte slice -func (t *Timestamp) binaryGet(data []byte) error { - if len(data) != timestampLength { - return NewError(ErrCorruptData, "timestamp data has the wrong size") - } - t.Time = binary.LittleEndian.Uint64(data[:8]) - return nil -} - -// binaryPut Serializes a Timestamp to a byte slice -func (t *Timestamp) binaryPut(data []byte) error { - if len(data) != timestampLength { - return NewError(ErrCorruptData, "timestamp data has the wrong size") - } - binary.LittleEndian.PutUint64(data, t.Time) - return nil -} - // UnmarshalJSON implements the json.Unmarshaller interface func (t *Timestamp) UnmarshalJSON(data []byte) error { return json.Unmarshal(data, &t.Time) |