]>
Commit | Line | Data |
---|---|---|
663996b3 MS |
1 | <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>systemd.time</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><style> |
2 | a.headerlink { | |
3 | color: #c60f0f; | |
4 | font-size: 0.8em; | |
5 | padding: 0 4px 0 4px; | |
6 | text-decoration: none; | |
7 | visibility: hidden; | |
8 | } | |
9 | ||
10 | a.headerlink:hover { | |
11 | background-color: #c60f0f; | |
12 | color: white; | |
13 | } | |
14 | ||
15 | h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, dt:hover > a.headerlink { | |
16 | visibility: visible; | |
17 | } | |
18 | </style><a href="index.html">Index </a>· | |
19 | <a href="systemd.directives.html">Directives </a>· | |
20 | <a href="../python-systemd/index.html">Python </a>· | |
21 | <a href="../libudev/index.html">libudev </a>· | |
e3bff60a MP |
22 | <a href="../libudev/index.html">gudev </a><span style="float:right">systemd 220</span><hr><div class="refentry"><a name="systemd.time"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>systemd.time — Time and date specifications</p></div><div class="refsect1"><a name="idm140185987565920"></a><h2 id="Description">Description<a class="headerlink" title="Permalink to this headline" href="#Description">¶</a></h2><p>In systemd, timestamps, time spans, and calendar events are |
23 | displayed and may be specified in closely related syntaxes.</p></div><div class="refsect1"><a name="idm140185987564592"></a><h2 id="Displaying Time Spans">Displaying Time Spans<a class="headerlink" title="Permalink to this headline" href="#Displaying%20Time%20Spans">¶</a></h2><p>Time spans refer to time durations. On display, systemd will | |
e735f4d4 MP |
24 | present time spans as a space-separated series of time values each |
25 | suffixed by a time unit.</p><pre class="programlisting">2h 30min</pre><p>All specified time values are meant to be added up. The | |
e3bff60a | 26 | above hence refers to 150 minutes.</p></div><div class="refsect1"><a name="idm140185987562272"></a><h2 id="Parsing Time Spans">Parsing Time Spans<a class="headerlink" title="Permalink to this headline" href="#Parsing%20Time%20Spans">¶</a></h2><p>When parsing, systemd will accept the same time span syntax. |
e735f4d4 MP |
27 | Separating spaces may be omitted. The following time units are |
28 | understood:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>usec, us</p></li><li class="listitem"><p>msec, ms</p></li><li class="listitem"><p>seconds, second, sec, s</p></li><li class="listitem"><p>minutes, minute, min, m</p></li><li class="listitem"><p>hours, hour, hr, h</p></li><li class="listitem"><p>days, day, d</p></li><li class="listitem"><p>weeks, week, w</p></li><li class="listitem"><p>months, month</p></li><li class="listitem"><p>years, year, y</p></li></ul></div><p>If no time unit is specified, generally seconds are assumed, | |
29 | but some exceptions exist and are marked as such. In a few cases | |
30 | "<code class="literal">ns</code>", "<code class="literal">nsec</code>" is accepted too, | |
31 | where the granularity of the time span allows for this.</p><p>Examples for valid time span specifications:</p><pre class="programlisting">2 h | |
663996b3 MS |
32 | 2hours |
33 | 48hr | |
34 | 1y 12month | |
35 | 55s500ms | |
e3bff60a | 36 | 300ms20s 5day</pre></div><div class="refsect1"><a name="idm140185982653296"></a><h2 id="Displaying Timestamps">Displaying Timestamps<a class="headerlink" title="Permalink to this headline" href="#Displaying%20Timestamps">¶</a></h2><p>Timestamps refer to specific, unique points in time. On |
e735f4d4 MP |
37 | display, systemd will format these in the local timezone as |
38 | follows:</p><pre class="programlisting">Fri 2012-11-23 23:02:15 CET</pre><p>The weekday is printed according to the locale choice of the | |
e3bff60a | 39 | user.</p></div><div class="refsect1"><a name="idm140185982650992"></a><h2 id="Parsing Timestamps">Parsing Timestamps<a class="headerlink" title="Permalink to this headline" href="#Parsing%20Timestamps">¶</a></h2><p>When parsing systemd will accept a similar timestamp syntax, |
e735f4d4 MP |
40 | but excluding any timezone specification (this limitation might be |
41 | removed eventually). The weekday specification is optional, but | |
42 | when the weekday is specified it must either be in the abbreviated | |
43 | ("<code class="literal">Wed</code>") or non-abbreviated | |
44 | ("<code class="literal">Wednesday</code>") English language form (case does | |
45 | not matter), and is not subject to the locale choice of the user. | |
46 | Either the date, or the time part may be omitted, in which case | |
47 | the current date or 00:00:00, resp., is assumed. The seconds | |
48 | component of the time may also be omitted, in which case ":00" is | |
49 | assumed. Year numbers may be specified in full or may be | |
50 | abbreviated (omitting the century).</p><p>A timestamp is considered invalid if a weekday is specified | |
51 | and the date does not actually match the specified day of the | |
52 | week.</p><p>When parsing, systemd will also accept a few special | |
53 | placeholders instead of timestamps: "<code class="literal">now</code>" may be | |
54 | used to refer to the current time (or of the invocation of the | |
55 | command that is currently executed). "<code class="literal">today</code>", | |
56 | "<code class="literal">yesterday</code>", "<code class="literal">tomorrow</code>" refer to | |
57 | 00:00:00 of the current day, the day before or the next day, | |
58 | respectively.</p><p>When parsing, systemd will also accept relative time | |
59 | specifications. A time span (see above) that is prefixed with | |
60 | "<code class="literal">+</code>" is evaluated to the current time plus the | |
61 | specified time span. Correspondingly, a time span that is prefixed | |
62 | with "<code class="literal">-</code>" is evaluated to the current time minus | |
63 | the specified time span. Instead of prefixing the time span with | |
64 | "<code class="literal">+</code>" or "<code class="literal">-</code>", it may also be | |
65 | suffixed with a space and the word "<code class="literal">left</code>" or | |
66 | "<code class="literal">ago</code>".</p><p>Finally, a timespan prefixed with "<code class="literal">@</code>" is | |
67 | evaluated relative to the UNIX time epoch 1st Jan, 1970, | |
68 | 00:00.</p><p>Examples for valid timestamps and their normalized form | |
69 | (assuming the current time was 2012-11-23 18:15:22):</p><pre class="programlisting">Fri 2012-11-23 11:12:13 → Fri 2012-11-23 11:12:13 | |
663996b3 | 70 | 2012-11-23 11:12:13 → Fri 2012-11-23 11:12:13 |
e735f4d4 MP |
71 | 2012-11-23 → Fri 2012-11-23 00:00:00 |
72 | 12-11-23 → Fri 2012-11-23 00:00:00 | |
73 | 11:12:13 → Fri 2012-11-23 11:12:13 | |
74 | 11:12 → Fri 2012-11-23 11:12:00 | |
75 | now → Fri 2012-11-23 18:15:22 | |
76 | today → Fri 2012-11-23 00:00:00 | |
77 | yesterday → Fri 2012-11-22 00:00:00 | |
78 | tomorrow → Fri 2012-11-24 00:00:00 | |
79 | +3h30min → Fri 2012-11-23 21:45:22 | |
80 | -5s → Fri 2012-11-23 18:15:17 | |
81 | 11min ago → Fri 2012-11-23 18:04:22 | |
82 | @1395716396 → Tue 2014-03-25 03:59:56</pre><p>Note that timestamps printed by systemd will not be parsed | |
83 | correctly by systemd, as the timezone specification is not | |
84 | accepted, and printing timestamps is subject to locale settings | |
85 | for the weekday while parsing only accepts English weekday | |
86 | names.</p><p>In some cases, systemd will display a relative timestamp | |
87 | (relative to the current time, or the time of invocation of the | |
88 | command) instead or in addition to an absolute timestamp as | |
89 | described above. A relative timestamp is formatted as | |
90 | follows:</p><p>2 months 5 days ago</p><p>Note that any relative timestamp will also parse correctly | |
e3bff60a | 91 | where a timestamp is expected. (see above)</p></div><div class="refsect1"><a name="idm140185982634544"></a><h2 id="Calendar Events">Calendar Events<a class="headerlink" title="Permalink to this headline" href="#Calendar%20Events">¶</a></h2><p>Calendar events may be used to refer to one or more points |
e735f4d4 MP |
92 | in time in a single expression. They form a superset of the |
93 | absolute timestamps explained above:</p><pre class="programlisting">Thu,Fri 2012-*-1,5 11:12:13</pre><p>The above refers to 11:12:13 of the first or fifth day of | |
94 | any month of the year 2012, but only if that day is a Thursday or | |
95 | Friday.</p><p>The weekday specification is optional. If specified, it | |
96 | should consist of one or more English language weekday names, | |
97 | either in the abbreviated (Wed) or non-abbreviated (Wednesday) | |
98 | form (case does not matter), separated by commas. Specifying two | |
99 | weekdays separated by "<code class="literal">-</code>" refers to a range of | |
100 | continuous weekdays. "<code class="literal">,</code>" and "<code class="literal">-</code>" | |
101 | may be combined freely.</p><p>In the date and time specifications, any component may be | |
102 | specified as "<code class="literal">*</code>" in which case any value will | |
103 | match. Alternatively, each component can be specified as a list of | |
104 | values separated by commas. Values may also be suffixed with | |
105 | "<code class="literal">/</code>" and a repetition value, which indicates that | |
106 | the value and all values plus multiples of the repetition value | |
107 | are matched.</p><p>Either time or date specification may be omitted, in which | |
108 | case the current day and 00:00:00 is implied, respectively. If the | |
109 | second component is not specified, "<code class="literal">:00</code>" is | |
110 | assumed.</p><p>Timezone names may not be specified.</p><p>The special expressions | |
111 | "<code class="literal">minutely</code>", | |
112 | "<code class="literal">hourly</code>", "<code class="literal">daily</code>", | |
113 | "<code class="literal">monthly</code>", "<code class="literal">weekly</code>", | |
114 | "<code class="literal">yearly</code>", | |
115 | "<code class="literal">quarterly</code>", | |
116 | "<code class="literal">semiannually</code>" may be used as | |
117 | calendar events which refer to | |
118 | "<code class="literal">*-*-* *:*:00</code>", | |
119 | "<code class="literal">*-*-* *:00:00</code>", | |
120 | "<code class="literal">*-*-* 00:00:00</code>", | |
121 | "<code class="literal">*-*-01 00:00:00</code>", | |
122 | "<code class="literal">Mon *-*-* 00:00:00</code>", | |
123 | "<code class="literal">*-01-01 00:00:00</code>", | |
124 | "<code class="literal">*-01,04,07,10-01 00:00:0</code>" and | |
125 | "<code class="literal">*-01,07-01 00:00:00</code>" respectively. | |
126 | </p><p>Examples for valid timestamps and their | |
127 | normalized form:</p><pre class="programlisting"> Sat,Thu,Mon-Wed,Sat-Sun → Mon-Thu,Sat,Sun *-*-* 00:00:00 | |
663996b3 | 128 | Mon,Sun 12-*-* 2,1:23 → Mon,Sun 2012-*-* 01,02:23:00 |
e735f4d4 MP |
129 | Wed *-1 → Wed *-*-01 00:00:00 |
130 | Wed-Wed,Wed *-1 → Wed *-*-01 00:00:00 | |
131 | Wed, 17:48 → Wed *-*-* 17:48:00 | |
663996b3 | 132 | Wed-Sat,Tue 12-10-15 1:2:3 → Tue-Sat 2012-10-15 01:02:03 |
e735f4d4 MP |
133 | *-*-7 0:0:0 → *-*-07 00:00:00 |
134 | 10-15 → *-10-15 00:00:00 | |
663996b3 MS |
135 | monday *-12-* 17:00 → Mon *-12-* 17:00:00 |
136 | Mon,Fri *-*-3,1,2 *:30:45 → Mon,Fri *-*-01,02,03 *:30:45 | |
137 | 12,14,13,12:20,10,30 → *-*-* 12,13,14:10,20,30:00 | |
138 | mon,fri *-1/2-1,3 *:30:45 → Mon,Fri *-01/2-01,03 *:30:45 | |
e735f4d4 MP |
139 | 03-05 08:05:40 → *-03-05 08:05:40 |
140 | 08:05:40 → *-*-* 08:05:40 | |
141 | 05:40 → *-*-* 05:40:00 | |
663996b3 | 142 | Sat,Sun 12-05 08:05:40 → Sat,Sun *-12-05 08:05:40 |
e735f4d4 MP |
143 | Sat,Sun 08:05:40 → Sat,Sun *-*-* 08:05:40 |
144 | 2003-03-05 05:40 → 2003-03-05 05:40:00 | |
145 | 2003-03-05 → 2003-03-05 00:00:00 | |
146 | 03-05 → *-03-05 00:00:00 | |
147 | hourly → *-*-* *:00:00 | |
148 | daily → *-*-* 00:00:00 | |
149 | monthly → *-*-01 00:00:00 | |
150 | weekly → Mon *-*-* 00:00:00 | |
151 | yearly → *-01-01 00:00:00 | |
152 | annually → *-01-01 00:00:00 | |
153 | *:2/3 → *-*-* *:02/3:00</pre><p>Calendar events are used by timer units, see | |
154 | <a href="systemd.timer.html"><span class="citerefentry"><span class="refentrytitle">systemd.timer</span>(5)</span></a> | |
e3bff60a | 155 | for details.</p></div><div class="refsect1"><a name="idm140185982611488"></a><h2 id="See Also">See Also<a class="headerlink" title="Permalink to this headline" href="#See%20Also">¶</a></h2><p> |
e735f4d4 MP |
156 | <a href="systemd.html"><span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span></a>, |
157 | <a href="journalctl.html"><span class="citerefentry"><span class="refentrytitle">journalctl</span>(1)</span></a>, | |
158 | <a href="systemd.timer.html"><span class="citerefentry"><span class="refentrytitle">systemd.timer</span>(5)</span></a>, | |
159 | <a href="systemd.unit.html"><span class="citerefentry"><span class="refentrytitle">systemd.unit</span>(5)</span></a>, | |
160 | <a href="systemd.directives.html"><span class="citerefentry"><span class="refentrytitle">systemd.directives</span>(7)</span></a> | |
161 | </p></div></div></body></html> |