Unifi AP keeps disconnecting from controller

I've spent countless hours debugging this, and solution is so simple...

Context.

I had an UniFI controller as an addon to Home Assistant on Raspberry Pi 4. It was working as expected for years. Then RPi 4 started to not be enough for my HA, and also other stuff needed some upgrade so I went full XCP-NG and virtualised everything (TrueNAS, HA, router and other stuff).

And then there was a problem with my AP disconnecting every ~ 24 hours leaving the AP in "Adopting" or "Offline" state or fluttering between the two.

Firstly I tought, that this may be due to IP change of HA/controller. I forgot AP in controller, I reset it with button, readopted, problem remained.

I then tried the same and after first boot, I adopted with set-inform command with IP of controller. Problem existed.

I updated couple of times both firmware and controller. No change.

I set up local DNS with name of unifi and unifi.local resolvable for devices, because I read somewhere that this also might be a problem. Nothing.

Then I finally changed default options of NTP (0.ubnt.pool.ntp.org and so on) of Ubiquity to NTP servers from Poland which are tempus1.gum.gov.pl and tempus2.gum.gov.pl., and boom, I don't even had to readopt or restart AP. It went online in few seconds!

I don't know why this is the case, and why after going with controller to virtual environment was causing clock to drift so much in 24 hrs that AP clock was not in sync with controller, and why default ntp settings didn't correct the clock. But setting well known time servers as time source solved finally it for me.

It's worth noting that even when the AP is not connected to the controller, it still supports Wi-Fi well, however I rely very heavily on devices tracking in Home Assistant and I had to have working integration. Without it none of my outside lights ever lit because for HA no one is in home :) etc.

Also, while debugging this issue, sshing to AP and giving it set-inform command with IP of controller also resolved issue for short period of time.

For the record - NTP settings are in SETTINGS -> SYSTEM -> Application Configuration -> Network Time Protocol (NTP)