Skip to content Search Apps Documentation Source Content Run Reset Eval Playground File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

timepoint.gno

0.61 Kb · 40 lines
 1package manager
 2
 3import (
 4	"strconv"
 5	"time"
 6)
 7
 8type TimePoint int64
 9
10func NewTimePoint(timePoint int64) TimePoint {
11	return TimePoint(timePoint)
12}
13
14func CurrentTimePoint() TimePoint {
15	return TimePoint(time.Now().Unix())
16}
17
18func (t TimePoint) After(other TimePoint) bool {
19	return t > other
20}
21
22func (t TimePoint) Before(other TimePoint) bool {
23	return t < other
24}
25
26func (t TimePoint) Equal(other TimePoint) bool {
27	return t == other
28}
29
30func (t TimePoint) String() string {
31	return strconv.FormatInt(int64(t), 10)
32}
33
34func (t TimePoint) Int64() int64 {
35	return int64(t)
36}
37
38func (t TimePoint) IsZero() bool {
39	return t == 0
40}