The question may sound stupid, but here's my case: I have a C++ program on Jetson Nano (a Single Board Computer) and want to get current time and date. In my application however, I can't always connect the internet cable to the device. Although in the Ubuntu settings I told it to automatically get the time from the internet, when it powers on after a longer time period (when it was not connected to power), the system clock gets confused and has a completely wrong time and date. This is what my C++ program (using std::chrono::system_clock()) then picks up.
Is there a way to get around this issue? Somehow, make
does know when system time and date are set incorrect even if the device is not connected to the internet. I can tell because it fails when trying to compile with "Clock skew detected". How can I get the correct time and date when not connected to the internet?