But NTPSynchronized always return false despite of the command chronyc makestep 0.1 (Host OS ssh) 5 that should trigger the synhronization. Is there a way to force synchronization on the container side so that running the command above will reliably return true.
Hi, you don’t specify balenaOS version and device type, so my answer will need to be general in nature.
First, balenaOS uses chronyd to keep time synchronized. And the dbus call queries timedatectl, so the fact that it states NTP is not synchronized might not mean that chrony is not synchronized.
There is some extra detail about how chrony sets the synchonized state in the kernel and how timedatectl reads it here.
What I would suggest is that you use chronyc to see whether NTP is synchronized or not as a starting point.
Also, up to date balenaOS versions will detect when the time is not synched and will agressively poll NTP servers until it is, so there is nothing the application needs to do in this regardd.