~chrisppy/go-barefeed

ref: e76763008dc2b1750154fb00285056605c882e40 go-barefeed/time.go -rw-r--r-- 357 bytes
e7676300Chris Palmer fix textType 4 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())
}