rpc/ws: fix SlotsUpdatesResult timestamp resolution
This commit is contained in:
parent
4540aed8d5
commit
25b9f3025b
|
@ -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"`
|
||||
// Extra stats provided when a bank is frozen.
|
||||
|
|
12
types.go
12
types.go
|
@ -32,6 +32,18 @@ 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 {
|
||||
|
|
Loading…
Reference in New Issue