Skip to content

Apply timezone offset for single occurrence events in SimulatorProtocol - #3430

Open
Ekhorn wants to merge 4 commits into
mainfrom
bugfix/3226-simulator-agent-protocol-timezone
Open

Ekhorn wants to merge 4 commits into
mainfrom
bugfix/3226-simulator-agent-protocol-timezone

Conversation

@Ekhorn

@Ekhorn Ekhorn commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Description

Checklist

  • 1. Acceptance criteria of the linked issue(s) are met
  • 2. Tests are written and all tests pass
  • 3. Changes are manually tested by you and the reviewer
  • 4. Documentation is written or updated

A single offset captured at scheduling time was applied to future local
times, so an occurrence spanning a daylight saving transition drifted by
an hour in both its predicted datapoints and its replay.
@Ekhorn Ekhorn self-assigned this Oct 14, 2026
@Ekhorn Ekhorn added the Bug Error or issue in the system label Oct 14, 2026
@sonarqubecloud

Copy link
Copy Markdown

@wborn wborn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an initial AI-assisted review.

The PR addresses the timezone handling issue for single occurrences and adds useful test coverage for daylight saving transitions. However, converting replay offsets to local wall-clock times can cause distinct predicted datapoints to receive the same timestamp during a spring-forward transition. This edge case should be addressed, with a regression test, before merging.

return predictedDatapoints;
}
long UTCTimestamp = timestamp - tzOffset;
long UTCTimestamp = toEpochMillis(timestamp, timezone, nowUTC);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converting replay offsets to local timestamps can produce duplicate predicted datapoints during a DST gap.

For example, with an occurrence starting at midnight on March 29, 2026 in Europe/Amsterdam, offsets of 7,200 and 10,800 seconds both resolve to 03:00 CEST. Previously, these offsets produced distinct predicted timestamps.

Could this case be handled explicitly, and could a regression test cover datapoints spanning a spring-forward transition?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Error or issue in the system

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The simulator timezone field only works for recurring schedules

2 participants