Skip to content

Commit

Permalink
rfqmsg: ensure Unix time conversion to time.Time uses UTC
Browse files Browse the repository at this point in the history
Set the converted `time.Time` to UTC when transforming from Unix time.
This change promotes consistency and simplifies debugging.
  • Loading branch information
ffranr committed Nov 15, 2024
1 parent f48e568 commit b4e92eb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion rfqmsg/buy_accept.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func newBuyAcceptFromWireMsg(wireMsg WireMessage,
assetRate := msgData.InAssetRate.Val.IntoBigIntFixedPoint()

// Convert the unix timestamp in seconds to a time.Time.
expiry := time.Unix(int64(msgData.Expiry.Val), 0)
expiry := time.Unix(int64(msgData.Expiry.Val), 0).UTC()

return &BuyAccept{
Peer: wireMsg.Peer,
Expand Down
2 changes: 1 addition & 1 deletion rfqmsg/buy_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func NewBuyRequestFromWire(wireMsg WireMessage,
return nil, fmt.Errorf("expiry time exceeds maximum int64")
}

expiry := time.Unix(int64(msgData.Expiry.Val), 0)
expiry := time.Unix(int64(msgData.Expiry.Val), 0).UTC()

// Extract the suggested asset to BTC rate if provided.
var assetRateHint fn.Option[AssetRate]
Expand Down
2 changes: 1 addition & 1 deletion rfqmsg/sell_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func NewSellRequestFromWire(wireMsg WireMessage,
"request")
}

expiry := time.Unix(int64(msgData.Expiry.Val), 0)
expiry := time.Unix(int64(msgData.Expiry.Val), 0).UTC()

// Extract the suggested asset to BTC rate if provided.
var assetRateHint fn.Option[AssetRate]
Expand Down

0 comments on commit b4e92eb

Please sign in to comment.