fix: always emit timestamps in UTC to avoid timezone offset issues

This commit is contained in:
Joel Male
2026-02-25 14:51:29 +10:00
parent 7321689cc4
commit ac607c2757
2 changed files with 5 additions and 5 deletions
+3 -3
View File
@@ -482,7 +482,7 @@ type latestRelease struct {
} }
func runAutoUpdater(config *Config) { func runAutoUpdater(config *Config) {
t := time.Now().Add(30 * time.Second) t := time.Now().UTC().Add(30 * time.Second)
nextUpdateCheck = &t nextUpdateCheck = &t
time.Sleep(30 * time.Second) time.Sleep(30 * time.Second)
@@ -496,7 +496,7 @@ func runAutoUpdater(config *Config) {
} }
func scheduleNextUpdateCheck() { func scheduleNextUpdateCheck() {
t := time.Now().Add(updateCheckInterval) t := time.Now().UTC().Add(updateCheckInterval)
nextUpdateCheck = &t nextUpdateCheck = &t
} }
@@ -730,7 +730,7 @@ func collectAndSend(config *Config) {
func collectMetrics(config *Config) (*Metrics, error) { func collectMetrics(config *Config) (*Metrics, error) {
metrics := &Metrics{ metrics := &Metrics{
Timestamp: time.Now(), Timestamp: time.Now().UTC(),
Token: config.Token, Token: config.Token,
Hostname: config.Hostname, Hostname: config.Hostname,
CollectorVersion: version, CollectorVersion: version,
+2 -2
View File
@@ -1,9 +1,9 @@
{ {
"timestamp": "2026-02-14T14:09:08.879637+10:00", "timestamp": "2026-02-14T04:09:08.879637Z",
"token": "pw_tok_example_abc123", "token": "pw_tok_example_abc123",
"hostname": "web-1", "hostname": "web-1",
"collector_version": "0.2.0", "collector_version": "0.2.0",
"next_update_check": "2026-02-25T16:30:00+10:00", "next_update_check": "2026-02-25T06:30:00Z",
"uptime": 92582, "uptime": 92582,
"system": { "system": {
"os": "linux", "os": "linux",