~chrisppy/go-barefeed

ref: 63fc114fd6c8a8779e44c7042a5c1a6f543a76fb go-barefeed/time.go -rw-r--r-- 357 bytes
63fc114fChris Palmer updates from schema 5 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
package barefeed

import "time"

// Timestamp type to hold the UTC Unix value of time
type Timestamp int64

// Time will convert the timestamp to time
func (t Timestamp) Time() time.Time {
	return time.Unix(int64(t), 0).UTC()
}

// ToTimestamp will convert the time to timestamp
func ToTimestamp(t time.Time) Timestamp {
	return Timestamp(t.UTC().Unix())
}