Time calculations: different chronologies

I try to compare dates/times of different sources, now() and from CalDAV.

CalDAV returns a date with GJChronology[Europe/Berlin] while now returns a value with ISOChronology[Europe/Berlin].
As consequence the difference of the times has a deviation of one hour.

I think, that there are two possibilities to solve it:

  • handle it accordingly in the rule
  • configure the calendar-server (in my case davical) to deliver ISO.
    In both cases I have no clue how to solve it.

So far my config in OH2:

items:

String 		sCalInfo_Name1	"Termin 1 [%s]"     									<none>	{ caldavPersonal="calendar:HA_Info type:UPCOMING eventNr:1 value:NAME" }
DateTime 	dtCalInfo_Time1	"Zeit Termin 1 [%1$td.%1$tm. %1$tR]" 	<none>	{ caldavPersonal="calendar:HA_Info type:UPCOMING eventNr:1 value:START" }
String 		sCalInfo_Name2	"Termin 2 [%s]"     									<none>	{ caldavPersonal="calendar:HA_Info type:UPCOMING eventNr:2 value:NAME" }
DateTime 	dtCalInfo_Time2	"Zeit Termin 2 [%1$td.%1$tm. %1$tR]" 	<none>	{ caldavPersonal="calendar:HA_Info type:UPCOMING eventNr:2 value:START" }
 // Beginn des Termins in ca. 12 Stunden
 // Kalender wird alle 10 Minuten abgefragt, es soll nur eine Nachricht versendet werden
val Functions$Function2 EreignisNachricht12h = [
								StringItem		parEreignisname,				// Item für Text
								DateTimeItem	parZeit 								// Item für Zeitpunkt
|			
  if (parZeit.state != UNDEF)
  {
  	logInfo("EN12h", parEreignisname.state + " " + parZeit.state.toString + " " + parZeit.name)
	var DateTime NowPlus12 =  new DateTime(now.toDateTime.plusHours(12))
	logInfo("Kalender1", NowPlus12.toString +  " " + NowPlus12.chronology)
	var DateTime Ereignis  =  new DateTime((parZeit.state as DateTimeType).calendar)
	logInfo("Kalender2", Ereignis.toString +  " " + Ereignis.chronology)

	var DateTime Diff = NowPlus12.minus(Ereignis.millis)
	logInfo("Kalender3", Diff.toString +  " " + Diff.chronology)

	if ( NowPlus12.minus(Ereignis.millis).getMinuteOfDay < 10)
	{
	  	logInfo("EN12h", parZeit.state.toString)
		sendTelegram("Haus", "Folgender Termin steht an:\r\n" + parEreignisname.state)
	  }
  }
]

// 12 Stunden vor Ereignis Telegram versenden
// alle 10 Minuten prüfen
rule "Kalender Info-Email 12 Stunden vor dem Ereignis"
when
		Time cron "0 0/5 * * * ?"
then
	EreignisNachricht12h.apply(sCalInfo_Name1, dtCalInfo_Time1)
	EreignisNachricht12h.apply(sCalInfo_Name2, dtCalInfo_Time2)
end

result in logfile:

2017-01-15 10:40:03.431 [INFO ] [pse.smarthome.model.script.Kalender1] - 2017-01-15T22:40:03.425+01:00 ISOChronology[Europe/Berlin]
2017-01-15 10:40:03.472 [INFO ] [pse.smarthome.model.script.Kalender2] - 2017-01-15T22:00:00.000+01:00 GJChronology[Europe/Berlin]
2017-01-15 10:40:03.516 [INFO ] [pse.smarthome.model.script.Kalender3] - 1970-01-01T01:40:03.425+01:00 ISOChronology[Europe/Berlin]