I am generating two sets of repeating events in seperate loop iterations but am having a conflict when comparing the generated results for conflicts. This seems to be when the times go backwards and I am unsure how to solve this?
The first repeat event will:
- repeat everyday at 00:00 to 01:00 in "Europe/Stockholm" time
- from 03/11/2015
- looping until forever.
The second repeat event will:
- repeat everyday at 01:00 to 02:00 in "Europe/Stockholm" time
- from 03/11/2015
- again looping forever.
To generate the events I am looping through everyday in the local time zone "Europe/Stockholm" using Nodatime like this:
String timeZone = "Europe/Stockholm";
for (ZonedDateTime date_Local = repeatSeriesStartDate_Local; date_Local <= LoopEndDate_Local; date_Local = new ZonedDateTime(Instant.FromDateTimeUtc(date_Local.ToDateTimeUtc().AddDays(1).ToUniversalTime()),timeZone))
My issue arises on October 29/30th 2016 When the clocks go backwards and the 2nd rule conflicts with the first. http://www.timeanddate.com/time/change/sweden/stockholm?year=2016
The conflict times are as follows:
- "2016-10-29T23:00:00Z" to "2016-10-30T01:00:00Z"
- "2016-10-30T00:00:00Z" to "2016-10-30T01:00:00Z"
I am using an algorithm like this one to test for conflicts https://stackoverflow.com/a/325964/884132
How should I handle these time shifting conflicts?