]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
units: add time-set.target
authorPeter A. Bigot <pab@pabigot.com>
Mon, 30 Apr 2018 12:05:29 +0000 (07:05 -0500)
committerLennart Poettering <lennart@poettering.net>
Mon, 8 Apr 2019 12:34:05 +0000 (14:34 +0200)
time-sync.target is supposed to indicate system clock is synchronized
with a remote clock, but as used through 241 it only provided a system
clock that was updated based on a locally-maintained timestamp.  Systems
that are powered off for extended periods would not come up with
accurate time.

Retain the existing behavior using a new time-set.target leaving
time-sync.target for cases where accuracy is required.

Closes #8861

man/systemd.special.xml
units/meson.build
units/systemd-timesyncd.service.in
units/systemd-tmpfiles-clean.service.in
units/time-set.target [new file with mode: 0644]
units/time-sync.target

index b7df5016ce4881ecf94a57b257a8504b3e95b117..248fb924dba4935a383af512162aeb64dbe314ca 100644 (file)
@@ -77,6 +77,7 @@
     <filename>sysinit.target</filename>,
     <filename>system-update.target</filename>,
     <filename>system-update-pre.target</filename>,
+    <filename>time-set.target</filename>,
     <filename>time-sync.target</filename>,
     <filename>timers.target</filename>,
     <filename>umount.target</filename>,
             the <literal>$portmap</literal> facility.</para>
           </listitem>
         </varlistentry>
+        <varlistentry>
+          <term><filename>time-set.target</filename></term>
+          <listitem>
+            <para>Services responsible for setting the system clock from
+            a local source (such as a maintained timestamp file or
+            imprecise real-time clock) should pull in this target and
+            order themselves before it.  Services where approximate time
+            is desired should be ordered after this unit, but not pull
+            it in.  This target does not provide the accuracy guarantees
+            of <filename>time-sync.target</filename>.</para>
+          </listitem>
+        </varlistentry>
         <varlistentry>
           <term><filename>time-sync.target</filename></term>
           <listitem>
index a53632cd9db9d66f1eaca1654a74e31df86552e4..a5610506d5182ead4e8a1a67633842db2f9ad0ed 100644 (file)
@@ -104,6 +104,7 @@ units = [
          'sockets.target.wants/'],
         ['systemd-udevd-kernel.socket',         '',
          'sockets.target.wants/'],
+        ['time-set.target',                     ''],
         ['time-sync.target',                    ''],
         ['timers.target',                       ''],
         ['tmp.mount',                           '',
index 6512531e1c5aa3811b5a3c3fb5b79012c19c7302..2d8d14f6de0f5c5670bebc7c90237db798184ccc 100644 (file)
@@ -14,9 +14,9 @@ ConditionCapability=CAP_SYS_TIME
 ConditionVirtualization=!container
 DefaultDependencies=no
 After=systemd-remount-fs.service systemd-sysusers.service
-Before=time-sync.target sysinit.target shutdown.target
+Before=time-set.target sysinit.target shutdown.target
 Conflicts=shutdown.target
-Wants=time-sync.target
+Wants=time-set.target time-sync.target
 
 [Service]
 AmbientCapabilities=CAP_SYS_TIME
index d1025afadb4d34ca16f69b9173e686a61b0722c4..9e2f04bfefdbe358369dc66e34a582f742bd932e 100644 (file)
@@ -12,7 +12,7 @@ Description=Cleanup of Temporary Directories
 Documentation=man:tmpfiles.d(5) man:systemd-tmpfiles(8)
 DefaultDependencies=no
 Conflicts=shutdown.target
-After=local-fs.target time-sync.target
+After=local-fs.target time-set.target
 Before=shutdown.target
 
 [Service]
diff --git a/units/time-set.target b/units/time-set.target
new file mode 100644 (file)
index 0000000..6b40033
--- /dev/null
@@ -0,0 +1,13 @@
+#  SPDX-License-Identifier: LGPL-2.1+
+#
+#  This file is part of systemd.
+#
+#  systemd is free software; you can redistribute it and/or modify it
+#  under the terms of the GNU Lesser General Public License as published by
+#  the Free Software Foundation; either version 2.1 of the License, or
+#  (at your option) any later version.
+
+[Unit]
+Description=System Time Set
+Documentation=man:systemd.special(7)
+RefuseManualStart=yes
index 1533c7c33c9beb720f9176d170bf905d8fa223d9..9106502e8becf12f820e4ac492f06ecd27339a62 100644 (file)
@@ -11,3 +11,5 @@
 Description=System Time Synchronized
 Documentation=man:systemd.special(7)
 RefuseManualStart=yes
+After=time-set.target
+Wants=time-set.target