Projekt

Allgemein

Profil

Fehler #464

Von Maximilian Seesslen vor 2 Monaten aktualisiert

A replay is mapped one hour behind.

Day-light-saving is implemented now so CANRec is working. CET/CEST(MEZ/MESZ) still hardcoded.
Problem is that RTC stores date/time plain. It has to be calculated to UTC to store and send it.

Devices like CANDis use the time send via cordyceps to display it directly. Use UTC in RTC and configure shown time?
Cordyceps sends hour/minute/second of localtime.

* Lediglich im CANRec das Delta zu UTC einstellbar zu machen, waere am einfachsten. Dann wird die Sommerzeit gar nicht berechnet.
Es gibt nur einen Befehl, um beim starten das Delta festzulegen (via EEPROM). CET ist dann der Default.
CANRec koennte Sommerzeit selbst umstellen.

* Having UTC in RTC only and adding timezone in CRtc.

The timezone could be stored in EEPROM. When picolibc is using tzset(), it would be more complicated.

CANRec uses time(nullptr) for timestamps. Is it using gettimeofday()? converting utc from RTC to local time and converting it back to UTC again?

newlib/picolib: time() calls gettimeofday() with zeropointer to timezone. It assumes gettimeofday() returns UTC.
glibc calls __clock_gettime().

_POSIX.1-2008 marks gettimeofday() as obsolete, recommending the use of clock_gettime(2) instead._
TZ is ignored on linux kernel call.

What i did there:
calculated UTC from localtime in RTC. Used mktime to get time_t from localtime, but picolibc assumed it is UTC.

<pre><code class="cpp">
static_assert ( getEpoch( 2024, 11, 12, 12, 10, 1) == 1731413401, "Calculation of epoch wrong" );
#if IS_ENABLED ( BIWAK_RTC_HAS_UTC )
return( getEpoch(...) );
#else
return( getEpoch(...) + adjust );
#endif
</code></pre>

Zurück