Skip to content
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

Ensure all JSON timestamps use UTC time #1335

Merged
merged 2 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions internal/api/arm/correlation.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package arm

import (
"net/http"
"time"

"github.com/google/uuid"
)
Expand All @@ -21,9 +20,6 @@ type CorrelationData struct {

// CorrelationRequestID contains the value of header "x-ms-correlation-request-id".
CorrelationRequestID string `json:"correlationRequestId,omitempty"`

// RequestTime is the time that the request was received.
RequestTime time.Time `json:"requestTime,omitempty"`
}

// NewCorrelationData allocates and initializes a new CorrelationData from
Expand All @@ -33,6 +29,5 @@ func NewCorrelationData(r *http.Request) *CorrelationData {
RequestID: uuid.New(),
ClientRequestID: r.Header.Get(HeaderNameClientRequestID),
CorrelationRequestID: r.Header.Get(HeaderNameCorrelationRequestID),
RequestTime: time.Now(),
}
}
4 changes: 0 additions & 4 deletions internal/api/arm/correlation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ func TestNewCorrelationData(t *testing.T) {
if correlationData.CorrelationRequestID != correlation_request_id {
t.Errorf("got %v, but want %v", correlationData.CorrelationRequestID, correlation_request_id)
}

if correlationData.RequestTime.IsZero() {
t.Fatalf("correlationData.RequestTime was not initialized")
}
})
}
}
2 changes: 1 addition & 1 deletion internal/database/document.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func (doc *OperationDocument) ToStatus() *arm.Operation {
// is intended to be used with DBClient.UpdateOperationDoc.
func (doc *OperationDocument) UpdateStatus(status arm.ProvisioningState, err *arm.CloudErrorBody) bool {
if doc.Status != status {
doc.LastTransitionTime = time.Now()
doc.LastTransitionTime = time.Now().UTC()
doc.Status = status
doc.Error = err
return true
Expand Down
Loading