diff --git a/rpc/ws/slotsUpdatesSubscribe.go b/rpc/ws/slotsUpdatesSubscribe.go index 11931b4f..0dd8621d 100644 --- a/rpc/ws/slotsUpdatesSubscribe.go +++ b/rpc/ws/slotsUpdatesSubscribe.go @@ -22,7 +22,7 @@ type SlotsUpdatesResult struct { // The newly updated slot. Slot uint64 `json:"slot"` // The Unix timestamp of the update. - Timestamp *solana.UnixTimeSeconds `json:"timestamp"` + Timestamp *solana.UnixTimeMilliseconds `json:"timestamp"` // The update type. Type SlotsUpdatesType `json:"type"` } diff --git a/types.go b/types.go index 308d0c49..a22a8184 100644 --- a/types.go +++ b/types.go @@ -32,6 +32,17 @@ func (res UnixTimeSeconds) String() string { return res.Time().String() } +// UnixTimeMilliseconds represents a UNIX millisecond-resolution timestamp. +type UnixTimeMilliseconds int64 + +func (res UnixTimeMilliseconds) Time() time.Time { + return time.Unix(0, int64(res)*int64(time.Millisecond)) +} + +func (res UnixTimeMilliseconds) String() string { + return res.Time().String() +} + type DurationSeconds int64 func (res DurationSeconds) Duration() time.Duration {