Shield DS 3231 RTC, gestire ora legale

SukkoPera:
Stampa anche l'ora reale dell'RTC (rtc.now()) e poi vediamo. Ricorda che quella deve rimanere impostata su GMT/UTC.

2018/4/9 (Luned⸮) 18:12:26
 since midnight 1/1/1970 = 1523297546s = 17630d
 now + 7d + 30s: 2018/4/17 6:42:32

ovvero l'ora esatta

Se invece modifico in questo modo:

DateTime getLocalTime() {
  DateTime now = rtc.now();
  //int32_t deltaSecs = (utcOffset + dstOffset (now.day(), now.month(), now.year(), now.hour()) * 3600UL);
  const unsigned long SECS_PER_HOUR = 3600;
  int32_t deltaSecs = (utcOffset + dstOffset (now.day(), now.month(), now.year(), now.hour())) * SECS_PER_HOUR;
  
  DateTime correctedNow (now + TimeSpan(deltaSecs));
  return correctedNow;
}

void loop () {
 DateTime now = getLocalTime();
  //DateTime now = rtc.now();
...
...

addirittura mi aumenta di due ore :frowning: