tstor/daemons/kemono/client/models.go
royalcat 585f317478
Some checks failed
docker / build-docker (push) Failing after 34s
daemons separation
2024-11-24 20:32:26 +03:00

21 lines
345 B
Go

package client
import (
"encoding/json"
"time"
)
type Timestamp struct {
Time time.Time
}
func (t *Timestamp) UnmarshalJSON(b []byte) error {
var timestamp float64
err := json.Unmarshal(b, &timestamp)
if err != nil {
return err
}
t.Time = time.Unix(int64(timestamp), int64((timestamp-float64(int64(timestamp)))*1e9))
return nil
}