The hardware RTC would help to preserve time across boots, especially full power off, yes.
It doesn't add the slightest benefit for getting and maintaining an accurate time in the first place though.
Even the most accurate masterpiece of Swiss made wristwatch will just show a wrong time permanently if all you have for adjustment is "the sun is highest at high noon" in winter.
What we have now in oe-a is:
1st step: Restore build or last shutdown time early on boot (Like in Raspbian, but as "save-rtc.sh" it has been in yocto forever too, it was just disabled to keep other ugly workarounds working)
2nd step: Restore FP pseudo-RTC if it was powered and contains a realistic time
3rd step: Sync with NTP (Has always been in yocto too, but was broken, distros added another NTP shot in enigma2.sh as a workaround, but for boot services it came too late)
4th step: Maintain sync using NTP or DVB time (With oscam apparently even disallowing this)
1st and 3rd are common practice anyways:
1st: Even systemd alone will advance the system time to systemd built time for early boot, the fake-hwclock in Raspbian just makes it a bit more accurate.
At that stage, you do not even have access to a real RTC yet, so it won't get better here (And isn't even needed to get better).
2nd: All OSes I checked use NTP time sync when networked, common Linux distros like Debian/Linux/MiNT as well as Windows and macOS.
2nd differs from machines with a battery backed up hardware RTC only in the way that it will be useless after power off, but the vast majority of users won't ever notice as the time from 1st is still good enough for any task currently and predictably being invoked at that stage on an E2 box (Remember a networked box will get a very accurate time only seconds later). And non networked boxes are just even more unlikely to do anything at this stage that requires a precise time here.
Only boxes that are operated
- non networked
and
- not connected to DVB
would benefit from an RTC here.
So the problem(s) aren't in 1st, 2nd or 3rd, they reside in the 4th point:
For boxes that are not networked, the only source for time is the DVB transponder time and that one is almost entirely discarded later.
E2 allows the box to sync with DVB exactly once, all later so-called "syncs" are only allowed to confirm the time or more or less slowly drift it (max. +/- 120 sec adjustment).
All higher diffs are discarded.
So E2 puts the emphasis on bad transponders, which are not really a problem for our mainly Central European audience, as Astra (No matter if 19.2°E, 23.5°E or 28.5°E) and Hotbird seem to deliver accurate times.
It even does so in a way that the box is allowed to pick the time from a bad transponder first and then discards the good times from good transponders later.
And finally we have oscam with CLOCKBREAK that ruins even the small adjustments ...
So as far as I can see, the main issues are dvbtime.cpp in E2 and the clock fix in oscam.
It's boxes that got misadjusted in E2 or not adjusted thanks to oscam that are missing recordings, not boxes being off a bit during boot, before E2 even started.
So the whole discussion about HW-RTC reminds me of some car mechanics discussing how to upgrade a car with a seat heating, while that car wouldn't start at all thanks to a broken engine.
I have checked the CLOCKFIX related changes in oscam and as far as I can see, one can define CLOCK_MONOTONIC, but I have no clue if that would help at all.
IMHO, as we recommend oscam over all closed-source CAMs, the CLOCKFIX issue there should be addressed first, as it would currently prevent any time adjustments in E2 or through NTP entirely (= show stopper).
As soon or in parallel while that gets fixed, one could try to find better algorithms for the DVB sync to help those users that operate their box without network.
From what I understand, the time should be slewed rather than stepped for a beginning, as stepping time could make several events either be missed (If stepped over) or to trigger far too fast (If stepping inside the pause between).
Second, in case there are known good transponders on any of the set up positions, why not have E2 forcibly start there? Just until we got a time, after that, E2 can switch to the user selected startup or last tuned station.
Once we got that, one could try to detect transponders reporting local time by just subtracting full half hours from the difference. A transponder reporting UTC+1 and 3800 sec difference is probably still right and we are 200 sec off after subtracting the 3600 sec for the one hour ...
Edited by SpaceRat, 31 December 2017 - 09:40.