You still don't get it.
Your mind is so pre-occupied with something completely different that you completely miss the point here, and you go on and on about things not relevant to the problem at hand.
So, one last time from the top.
Two pieces of functionality are needed:
1. An option for the end-user to select which time sync mechanism is desired. This option is defined as string, with possible options:
- "dvb": only use transponder time, whether available or not
- "ntp": only use time from an external NTP source, whether available or not
- "auto", by default use ntp functionality, but if no external source is available, fall back to transponder time
2. A function / class / method that implements this functionality in RUNTIME. (note, this is important! )
This function needs to be called at two different moments:
- when the user changes the preference in the configuration
- when Enigma starts, as it is RUNTIME configuration !
In both cases, the function needs to be called with the value the user configured, i.e. the selected string value.
So:
Iissue #1: The function currently implemented doesn't reflect the defined functionality for all options (namely, "ntp" now falls back to "dvb" if no IP is present, which is both wrong and not relevant )
Issue #2: The function is called at startup not with the configured value, but with a not supported argument, a boolean. The fact that this somewhat and sometime works is due to the way the function is coded, and therefore pure luck.
Issue #3: The availability of an IP address, or lack thereof, doesn't say anything about whether or not NTP will provide the correct time, so that check is wrong.
These need to be addressed.
All the rest is fuzz and disturbance in this discussion, as it is not even defined as "nice to have".
So focus on addressing the problem, instead of shooting off in all sort of directions, and add more code that doesn't do what it should do.
edit:
To elabortate: the fact that an IP address is or isn't issued doesn't say anything about NTP working or not. In my case, I block all outgoing traffic on my firewall, so pool.ntp.org (which is the default) will never work for me, whether or not the box has an IP.
If you want to make sure NTP works, the only way to check that is manually calling ntpdate-sync and check its return values. Alternatively, you could check if the current date is 1970, if so, there was no valid date set before Enigma started.
But even then, if I configure "ntp", I do that because I DONT want Enigma to fall back to transponder time. If I wanted that, I would have configured "auto". So don't even think about adding code to break that functionality too !
Edited by WanWizard, 26 October 2023 - 17:52.