Skip to content

Commit 847b852

Browse files
committed
rfqmsg: ensure Unix time conversion to time.Time uses UTC
Set the converted `time.Time` to UTC when transforming from Unix time. This change promotes consistency and simplifies debugging.
1 parent 27dcb81 commit 847b852

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

rfqmsg/buy_accept.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func newBuyAcceptFromWireMsg(wireMsg WireMessage,
6565
assetRate := msgData.InAssetRate.Val.IntoBigIntFixedPoint()
6666

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

7070
return &BuyAccept{
7171
Peer: wireMsg.Peer,

rfqmsg/buy_request.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ func NewBuyRequestFromWire(wireMsg WireMessage,
127127
return nil, fmt.Errorf("expiry time exceeds maximum int64")
128128
}
129129

130-
expiry := time.Unix(int64(msgData.Expiry.Val), 0)
130+
expiry := time.Unix(int64(msgData.Expiry.Val), 0).UTC()
131131

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

rfqmsg/sell_request.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ func NewSellRequestFromWire(wireMsg WireMessage,
121121
"request")
122122
}
123123

124-
expiry := time.Unix(int64(msgData.Expiry.Val), 0)
124+
expiry := time.Unix(int64(msgData.Expiry.Val), 0).UTC()
125125

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

0 commit comments

Comments
 (0)