How can I recognize which service provides time-sync.target in systemd? Is it configurable or is it hardcoded in systemd? How can I configure my custom time-sync daemon/service to provide this target?
systemctl show time-sync.target
to see the information and configuration maintained by systemd for this target. In particular, this will tell you that it is part of the special systemd units and documented there:
Services responsible for synchronizing the system clock from a remote source (such as NTP client implementations) should pull in this target and order themselves before it. All services where correct time is essential should be ordered after this unit, but not pull it in. systemd automatically adds dependencies of type
After=for this target unit to all SysV init script service units with an LSB header referring to the "
It is fully configurable (use
systemctl edit to override any aspect you want to). As mentioned above, services which provide time synchronisation (e.g.
systemd-timesyncd.service) declare that they want this target, and order themselves before it; services which need time synchronisation order themselves after it.
To configure a time synchronisation service, copy the relevant parts of
[Unit] Before=time-sync.target Wants=time-sync.target