Problem with setSyncProvider() [from Time Library]

In my program I want to set the clock by NTP, but when calling the function setSyncProvider(getNtpTime);

setSyncProvider does not cause a synchronization. It simply defines what function to call when the synchronization needs to happen.

So, your fundamental assumption is flawed.

There is another method to define when the synchronization is to occur. It might be possible to modify the library to have some specific interval (perhaps 0) have special meaning, like sync now but only once. It might even already have that capability.