rip off go-nostr for filters and all necessaries
This commit is contained in:
17
timestamp/timestamp.go
Normal file
17
timestamp/timestamp.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package timestamp
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"golang.org/x/exp/constraints"
|
||||
)
|
||||
|
||||
type Timestamp int64
|
||||
|
||||
func Now() Timestamp { return Timestamp(time.Now().Unix()) }
|
||||
|
||||
func New[T constraints.Integer | constraints.Float](t T) Timestamp {
|
||||
return Timestamp(t)
|
||||
}
|
||||
|
||||
func (t Timestamp) Time() time.Time { return time.Unix(int64(t), 0) }
|
||||
Reference in New Issue
Block a user