Fix timezone issues by enforcing UTC for all time operations#244
Fix timezone issues by enforcing UTC for all time operations#244
Conversation
Replace all time.Now() calls with time.Now().UTC() to prevent issues during daylight saving time shifts and other timezone-related changes. This ensures consistent time operations regardless of the system's local timezone setting. Changes: - modes.go: Updated all timing/latency measurements to use UTC - pkg/results/: Updated result tracking timestamps to use UTC - pkg/workloads/: Updated workload generators to use UTC for random seeding and time calculations - random/random.go: Updated global seed generation to use UTC - main.go: Updated startTime initialization to use UTC - Test files: Updated to use UTC for consistency - Added comprehensive timezone tests to verify UTC enforcement Co-authored-by: fruch <340979+fruch@users.noreply.github.com>
The variable 'startTime' in timezone_test.go was shadowing the global 'startTime' variable declared in main.go. Renamed the local variable to 'histogramStartTime' to fix the govet shadow warning. Co-authored-by: fruch <340979+fruch@users.noreply.github.com>
|
@fruch I've already worked on it 2 days ago, haven't finished it, will push it in tomorrow. |
it's a basic builtin utility, not sure wrapping it is a better solution. also if you were working on something, you should state it on the issue (move it in progress by the minimum) |
Fix timezone issues with time.Now() usage
Based on analysis of the codebase, I've identified and fixed all instances of
time.Now()to use UTC timezone to avoid issues during time shifts.Changes completed:
time.Now()usages and categorize by typeOriginal prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.