-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
multi: be consistent with UTC conversion of timestamp #976
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leaving a few small comments.
@@ -190,7 +190,7 @@ func (s *sessionRpcServer) AddSession(ctx context.Context, | |||
req *litrpc.AddSessionRequest) (*litrpc.AddSessionResponse, error) { | |||
|
|||
expiry := time.Unix(int64(req.ExpiryTimestampSeconds), 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this one should also be:
expiry := time.Unix(int64(req.ExpiryTimestampSeconds), 0) | |
expiry := time.Unix(int64(req.ExpiryTimestampSeconds), 0).UTC() |
Or we need to update protos to declare that the timestamp should explicitly be sent in through the request in UTC?
@@ -839,7 +839,7 @@ func (s *sessionRpcServer) AddAutopilotSession(ctx context.Context, | |||
} | |||
|
|||
expiry := time.Unix(int64(req.ExpiryTimestampSeconds), 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
startTime := time.Now().Add( | ||
-time.Duration(rateLim.NumHours) * time.Hour, | ||
) | ||
).UTC() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be:
startTime := time.Now().UTC().Add(
-time.Duration(rateLim.NumHours) * time.Hour,
)
Else there can be an discrepancy when the local timezone conversion happens right at a boundary of DST
.
thank goodness we dont need this |
Since we convert to UTC timestamps at persistence read/write time, we gotta make sure to compare against a consistent
Local
when comparing againsttime.Now()
in the code.