## Copyright (C) 2012 - 2025 ENCRYPTED SUPPORT LLC <adrelanos@whonix.org>
## See the file COPYING for copying conditions.

[Unit]
Description=Secure Distributed Web Date - Tor Restart Request File Watcher
Documentation=https://www.whonix.org/wiki/sdwdate
ConditionPathExists=!/run/qubes/this-is-templatevm
ConditionPathExists=!/run/qubes-service/no-sdwdate

## systemd-nspawn does not allow clock to be changed inside the container.
## Quote https://www.freedesktop.org/software/systemd/man/systemd-nspawn.html
## The host's network interfaces and the system clock may not be changed from within the container.
## https://forums.whonix.org/t/bootclockrandomization-always-moving-clock-plus-or-5-seconds/2200/10
ConditionVirtualization=!systemd-nspawn

After=network.target
Wants=network.target

After=rinetd.service
After=bootclockrandomization.service
After=tor.service
After=tor@default.service

Conflicts=systemd-timesyncd.service

[Service]
User=sdwdate
Group=sdwdate
ExecCondition=/usr/libexec/helper-scripts/has_netvm_on_qubes
ExecStart=/usr/libexec/sdwdate/sdwdate-start-anondate-set-file-watcher
#SuccessExitStatus=143
#TimeoutSec=30
#WatchdogSec=200m
Restart=always

AmbientCapabilities=CAP_SYS_TIME
CapabilityBoundingSet=CAP_SYS_TIME

[Install]
WantedBy=multi-user.target
