systemd.time.xml revision 8c275eef38bf7e3e592e4cb35a497522d1f15bb6
4f372d1b10414884e2526724169d6027468ea473gryzor<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
4f372d1b10414884e2526724169d6027468ea473gryzor "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4f372d1b10414884e2526724169d6027468ea473gryzor This file is part of systemd.
4f372d1b10414884e2526724169d6027468ea473gryzor Copyright 2010 Lennart Poettering
4f372d1b10414884e2526724169d6027468ea473gryzor systemd is free software; you can redistribute it and/or modify it
4f372d1b10414884e2526724169d6027468ea473gryzor under the terms of the GNU Lesser General Public License as published by
4f372d1b10414884e2526724169d6027468ea473gryzor the Free Software Foundation; either version 2.1 of the License, or
4f372d1b10414884e2526724169d6027468ea473gryzor (at your option) any later version.
4f372d1b10414884e2526724169d6027468ea473gryzor systemd is distributed in the hope that it will be useful, but
4f372d1b10414884e2526724169d6027468ea473gryzor WITHOUT ANY WARRANTY; without even the implied warranty of
4f372d1b10414884e2526724169d6027468ea473gryzor MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4f372d1b10414884e2526724169d6027468ea473gryzor Lesser General Public License for more details.
4f372d1b10414884e2526724169d6027468ea473gryzor You should have received a copy of the GNU Lesser General Public License
4f372d1b10414884e2526724169d6027468ea473gryzor along with systemd; If not, see <http://www.gnu.org/licenses/>.
4f372d1b10414884e2526724169d6027468ea473gryzor <refentryinfo>
4f372d1b10414884e2526724169d6027468ea473gryzor <authorgroup>
4f372d1b10414884e2526724169d6027468ea473gryzor </authorgroup>
4f372d1b10414884e2526724169d6027468ea473gryzor </refentryinfo>
dfb30ad72e3edf034d86c44c31ad9c8b1c41f178lgentis <refnamediv>
dfb30ad72e3edf034d86c44c31ad9c8b1c41f178lgentis <refpurpose>Time and date specifications</refpurpose>
dfb30ad72e3edf034d86c44c31ad9c8b1c41f178lgentis </refnamediv>
dfb30ad72e3edf034d86c44c31ad9c8b1c41f178lgentis <para>In systemd, timestamps, time spans, and calendar
dfb30ad72e3edf034d86c44c31ad9c8b1c41f178lgentis events are displayed and may be specified in closely
4f372d1b10414884e2526724169d6027468ea473gryzor related syntaxes.</para>
4f372d1b10414884e2526724169d6027468ea473gryzor </refsect1>
dfb30ad72e3edf034d86c44c31ad9c8b1c41f178lgentis <para>Time spans refer to time durations. On display,
dfb30ad72e3edf034d86c44c31ad9c8b1c41f178lgentis systemd will present time spans as a space-separated
dfb30ad72e3edf034d86c44c31ad9c8b1c41f178lgentis series of time values each suffixed by a time
dfb30ad72e3edf034d86c44c31ad9c8b1c41f178lgentis unit.</para>
4f372d1b10414884e2526724169d6027468ea473gryzor <para>All specified time values are meant to be added
4f372d1b10414884e2526724169d6027468ea473gryzor up. The above hence refers to 150 minutes.</para>
4f372d1b10414884e2526724169d6027468ea473gryzor </refsect1>
dfb30ad72e3edf034d86c44c31ad9c8b1c41f178lgentis <para>When parsing, systemd will accept the same
dfb30ad72e3edf034d86c44c31ad9c8b1c41f178lgentis time span syntax. Separating spaces may be omitted. The
4f372d1b10414884e2526724169d6027468ea473gryzor following time units are understood:</para>
4f372d1b10414884e2526724169d6027468ea473gryzor <itemizedlist>
4f372d1b10414884e2526724169d6027468ea473gryzor <listitem><para>seconds, second, sec, s</para></listitem>
4f372d1b10414884e2526724169d6027468ea473gryzor <listitem><para>minutes, minute, min, m</para></listitem>
92a7702da86bfc911826050b5c6f6593d3fa3ff5lgentis <listitem><para>hours, hour, hr, h</para></listitem>
4f372d1b10414884e2526724169d6027468ea473gryzor </itemizedlist>
4f372d1b10414884e2526724169d6027468ea473gryzor <para>If no time unit is specified, generally seconds
4f372d1b10414884e2526724169d6027468ea473gryzor are assumed, but some exceptions exist and are marked
4f372d1b10414884e2526724169d6027468ea473gryzor granularity of the time span allows for this.</para>
4f372d1b10414884e2526724169d6027468ea473gryzor <para>Examples for valid time span specifications:</para>
4f372d1b10414884e2526724169d6027468ea473gryzor <programlisting>2 h
4f372d1b10414884e2526724169d6027468ea473gryzor300ms20s 5day</programlisting>
4f372d1b10414884e2526724169d6027468ea473gryzor </refsect1>
4f372d1b10414884e2526724169d6027468ea473gryzor <para>Timestamps refer to specific, unique points in
4f372d1b10414884e2526724169d6027468ea473gryzor time. On display, systemd will format these in the
4f372d1b10414884e2526724169d6027468ea473gryzor local timezone as follows:</para>
92a7702da86bfc911826050b5c6f6593d3fa3ff5lgentis <programlisting>Fri 2012-11-23 23:02:15 CET</programlisting>
92a7702da86bfc911826050b5c6f6593d3fa3ff5lgentis <para>The weekday is printed according to the locale
92a7702da86bfc911826050b5c6f6593d3fa3ff5lgentis choice of the user.</para>
92a7702da86bfc911826050b5c6f6593d3fa3ff5lgentis </refsect1>
4f372d1b10414884e2526724169d6027468ea473gryzor <para>When parsing systemd will accept a similar
4f372d1b10414884e2526724169d6027468ea473gryzor timestamp syntax, but excluding any timezone
4f372d1b10414884e2526724169d6027468ea473gryzor specification (this limitation might be removed
4f372d1b10414884e2526724169d6027468ea473gryzor eventually). The weekday specification is optional,
4f372d1b10414884e2526724169d6027468ea473gryzor but when the weekday is specified it must either be
4f372d1b10414884e2526724169d6027468ea473gryzor non-abbreviated (<literal>Wednesday</literal>) English
4f372d1b10414884e2526724169d6027468ea473gryzor language form (case does not matter), and is not
4f372d1b10414884e2526724169d6027468ea473gryzor subject to the locale choice of the user. Either the
4f372d1b10414884e2526724169d6027468ea473gryzor date, or the time part may be omitted, in which case
4f372d1b10414884e2526724169d6027468ea473gryzor the current date or 00:00:00, resp., is assumed. The
4f372d1b10414884e2526724169d6027468ea473gryzor seconds component of the time may also be omitted, in
92a7702da86bfc911826050b5c6f6593d3fa3ff5lgentis which case ":00" is assumed. Year numbers may be
92a7702da86bfc911826050b5c6f6593d3fa3ff5lgentis specified in full or may be abbreviated (omitting the
92a7702da86bfc911826050b5c6f6593d3fa3ff5lgentis century).</para>
92a7702da86bfc911826050b5c6f6593d3fa3ff5lgentis <para>A timestamp is considered invalid if a weekday
4f372d1b10414884e2526724169d6027468ea473gryzor is specified and the date does not actually match the
4f372d1b10414884e2526724169d6027468ea473gryzor specified day of the week.</para>
4f372d1b10414884e2526724169d6027468ea473gryzor <para>When parsing, systemd will also accept a few
4f372d1b10414884e2526724169d6027468ea473gryzor special placeholders instead of timestamps:
4f372d1b10414884e2526724169d6027468ea473gryzor current time (or of the invocation of the command
4f372d1b10414884e2526724169d6027468ea473gryzor that is currently executed). <literal>today</literal>,
4f372d1b10414884e2526724169d6027468ea473gryzor current day, the day before or the next day,
4f372d1b10414884e2526724169d6027468ea473gryzor respectively.</para>
4f372d1b10414884e2526724169d6027468ea473gryzor <para>When parsing, systemd will also accept relative
4f372d1b10414884e2526724169d6027468ea473gryzor time specifications. A time span (see above) that is
4f372d1b10414884e2526724169d6027468ea473gryzor prefixed with <literal>+</literal> is evaluated to the
4f372d1b10414884e2526724169d6027468ea473gryzor current time plus the specified time
4f372d1b10414884e2526724169d6027468ea473gryzor span. Correspondingly, a time span that is prefixed
4f372d1b10414884e2526724169d6027468ea473gryzor with <literal>-</literal> is evaluated to the current
4f372d1b10414884e2526724169d6027468ea473gryzor time minus the specified time span. Instead of
4f372d1b10414884e2526724169d6027468ea473gryzor <para>Finally, a timespan prefixed with
4f372d1b10414884e2526724169d6027468ea473gryzor <literal>@</literal> is evaluated relative to the UNIX
4f372d1b10414884e2526724169d6027468ea473gryzor time epoch 1st Jan, 1970, 00:00.</para>
4f372d1b10414884e2526724169d6027468ea473gryzor <para>Examples for valid timestamps and their
4f372d1b10414884e2526724169d6027468ea473gryzor normalized form (assuming the current time was
4f372d1b10414884e2526724169d6027468ea473gryzor 2012-11-23 18:15:22):</para>
4f372d1b10414884e2526724169d6027468ea473gryzor <programlisting>Fri 2012-11-23 11:12:13 → Fri 2012-11-23 11:12:13
4f372d1b10414884e2526724169d6027468ea473gryzor 2012-11-23 11:12:13 → Fri 2012-11-23 11:12:13
4f372d1b10414884e2526724169d6027468ea473gryzor 2012-11-23 → Fri 2012-11-23 00:00:00
4f372d1b10414884e2526724169d6027468ea473gryzor 12-11-23 → Fri 2012-11-23 00:00:00
4f372d1b10414884e2526724169d6027468ea473gryzor 11:12:13 → Fri 2012-11-23 11:12:13
4f372d1b10414884e2526724169d6027468ea473gryzor 11:12 → Fri 2012-11-23 11:12:00
92a7702da86bfc911826050b5c6f6593d3fa3ff5lgentis now → Fri 2012-11-23 18:15:22
4f372d1b10414884e2526724169d6027468ea473gryzor today → Fri 2012-11-23 00:00:00
92a7702da86bfc911826050b5c6f6593d3fa3ff5lgentis yesterday → Fri 2012-11-22 00:00:00
4f372d1b10414884e2526724169d6027468ea473gryzor tomorrow → Fri 2012-11-24 00:00:00
4f372d1b10414884e2526724169d6027468ea473gryzor +3h30min → Fri 2012-11-23 21:45:22
4f372d1b10414884e2526724169d6027468ea473gryzor -5s → Fri 2012-11-23 18:15:17
4f372d1b10414884e2526724169d6027468ea473gryzor 11min ago → Fri 2012-11-23 18:04:22
4f372d1b10414884e2526724169d6027468ea473gryzor @1395716396 → Tue 2014-03-25 03:59:56</programlisting>
4f372d1b10414884e2526724169d6027468ea473gryzor <para>Note that timestamps printed by systemd will not
4f372d1b10414884e2526724169d6027468ea473gryzor be parsed correctly by systemd, as the timezone
92a7702da86bfc911826050b5c6f6593d3fa3ff5lgentis specification is not accepted, and printing timestamps
4f372d1b10414884e2526724169d6027468ea473gryzor is subject to locale settings for the weekday while
92a7702da86bfc911826050b5c6f6593d3fa3ff5lgentis parsing only accepts English weekday names.</para>
4f372d1b10414884e2526724169d6027468ea473gryzor <para>In some cases, systemd will display a relative
4f372d1b10414884e2526724169d6027468ea473gryzor timestamp (relative to the current time, or the time
4f372d1b10414884e2526724169d6027468ea473gryzor of invocation of the command) instead or in addition
4f372d1b10414884e2526724169d6027468ea473gryzor to an absolute timestamp as described above. A
4f372d1b10414884e2526724169d6027468ea473gryzor relative timestamp is formatted as follows:</para>
4f372d1b10414884e2526724169d6027468ea473gryzor <para>Note that any relative timestamp will also parse
4f372d1b10414884e2526724169d6027468ea473gryzor correctly where a timestamp is expected. (see above)</para>
4f372d1b10414884e2526724169d6027468ea473gryzor </refsect1>
4f372d1b10414884e2526724169d6027468ea473gryzor <para>Calendar events may be used to refer to one or
4f372d1b10414884e2526724169d6027468ea473gryzor more points in time in a single expression. They form
4f372d1b10414884e2526724169d6027468ea473gryzor a superset of the absolute timestamps explained above:</para>
92a7702da86bfc911826050b5c6f6593d3fa3ff5lgentis <programlisting>Thu,Fri 2012-*-1,5 11:12:13</programlisting>
92a7702da86bfc911826050b5c6f6593d3fa3ff5lgentis <para>The above refers to 11:12:13 of the first or
92a7702da86bfc911826050b5c6f6593d3fa3ff5lgentis fifth day of any month of the year 2012, given that it
4f372d1b10414884e2526724169d6027468ea473gryzor is a Thursday or Friday.</para>
4f372d1b10414884e2526724169d6027468ea473gryzor <para>The weekday specification is optional. If
4f372d1b10414884e2526724169d6027468ea473gryzor specified, it should consist of one or more English
4f372d1b10414884e2526724169d6027468ea473gryzor language weekday names, either in the abbreviated
4f372d1b10414884e2526724169d6027468ea473gryzor (Wed) or non-abbreviated (Wednesday) form (case does
4f372d1b10414884e2526724169d6027468ea473gryzor not matter), separated by commas. Specifying two
4f372d1b10414884e2526724169d6027468ea473gryzor weekdays separated by <literal>-</literal> refers to a
4f372d1b10414884e2526724169d6027468ea473gryzor range of continuous weekdays. <literal>,</literal> and
4f372d1b10414884e2526724169d6027468ea473gryzor <para>In the date and time specifications, any
4f372d1b10414884e2526724169d6027468ea473gryzor component may be specified as <literal>*</literal> in
4f372d1b10414884e2526724169d6027468ea473gryzor which case any value will match. Alternatively, each
4f372d1b10414884e2526724169d6027468ea473gryzor component can be specified as a list of values separated
4f372d1b10414884e2526724169d6027468ea473gryzor by commas. Values may also be suffixed with
4f372d1b10414884e2526724169d6027468ea473gryzor indicates that the value and all values plus multiples
4f372d1b10414884e2526724169d6027468ea473gryzor of the repetition value are matched.</para>
4f372d1b10414884e2526724169d6027468ea473gryzor <para>Either time or date specification may be
4f372d1b10414884e2526724169d6027468ea473gryzor omitted, in which case the current day and 00:00:00 is
4f372d1b10414884e2526724169d6027468ea473gryzor implied, respectively. If the second component is not
4f372d1b10414884e2526724169d6027468ea473gryzor <para>The special expressions
92a7702da86bfc911826050b5c6f6593d3fa3ff5lgentis <literal>hourly</literal>, <literal>daily</literal>,
92a7702da86bfc911826050b5c6f6593d3fa3ff5lgentis <literal>monthly</literal>, <literal>weekly</literal>,
92a7702da86bfc911826050b5c6f6593d3fa3ff5lgentis events which refer to
4f372d1b10414884e2526724169d6027468ea473gryzor <para>Examples for valid timestamps and their
4f372d1b10414884e2526724169d6027468ea473gryzor normalized form:</para>
4f372d1b10414884e2526724169d6027468ea473gryzor<programlisting> Sat,Thu,Mon-Wed,Sat-Sun → Mon-Thu,Sat,Sun *-*-* 00:00:00
4f372d1b10414884e2526724169d6027468ea473gryzor Mon,Sun 12-*-* 2,1:23 → Mon,Sun 2012-*-* 01,02:23:00
4f372d1b10414884e2526724169d6027468ea473gryzor Wed *-1 → Wed *-*-01 00:00:00
4f372d1b10414884e2526724169d6027468ea473gryzor Wed-Wed,Wed *-1 → Wed *-*-01 00:00:00
4f372d1b10414884e2526724169d6027468ea473gryzor Wed, 17:48 → Wed *-*-* 17:48:00
4f372d1b10414884e2526724169d6027468ea473gryzorWed-Sat,Tue 12-10-15 1:2:3 → Tue-Sat 2012-10-15 01:02:03
4f372d1b10414884e2526724169d6027468ea473gryzor *-*-7 0:0:0 → *-*-07 00:00:00
4f372d1b10414884e2526724169d6027468ea473gryzor 10-15 → *-10-15 00:00:00
4f372d1b10414884e2526724169d6027468ea473gryzor monday *-12-* 17:00 → Mon *-12-* 17:00:00
4f372d1b10414884e2526724169d6027468ea473gryzor Mon,Fri *-*-3,1,2 *:30:45 → Mon,Fri *-*-01,02,03 *:30:45
4f372d1b10414884e2526724169d6027468ea473gryzor 12,14,13,12:20,10,30 → *-*-* 12,13,14:10,20,30:00
4f372d1b10414884e2526724169d6027468ea473gryzor mon,fri *-1/2-1,3 *:30:45 → Mon,Fri *-01/2-01,03 *:30:45
4f372d1b10414884e2526724169d6027468ea473gryzor 03-05 08:05:40 → *-03-05 08:05:40
4f372d1b10414884e2526724169d6027468ea473gryzor 08:05:40 → *-*-* 08:05:40
4f372d1b10414884e2526724169d6027468ea473gryzor 05:40 → *-*-* 05:40:00
4f372d1b10414884e2526724169d6027468ea473gryzor Sat,Sun 12-05 08:05:40 → Sat,Sun *-12-05 08:05:40
4f372d1b10414884e2526724169d6027468ea473gryzor Sat,Sun 08:05:40 → Sat,Sun *-*-* 08:05:40
4f372d1b10414884e2526724169d6027468ea473gryzor 2003-03-05 05:40 → 2003-03-05 05:40:00
4f372d1b10414884e2526724169d6027468ea473gryzor 2003-03-05 → 2003-03-05 00:00:00
4f372d1b10414884e2526724169d6027468ea473gryzor 03-05 → *-03-05 00:00:00
4f372d1b10414884e2526724169d6027468ea473gryzor hourly → *-*-* *:00:00
4f372d1b10414884e2526724169d6027468ea473gryzor daily → *-*-* 00:00:00
4f372d1b10414884e2526724169d6027468ea473gryzor monthly → *-*-01 00:00:00
4f372d1b10414884e2526724169d6027468ea473gryzor weekly → Mon *-*-* 00:00:00
4f372d1b10414884e2526724169d6027468ea473gryzor yearly → *-01-01 00:00:00
4f372d1b10414884e2526724169d6027468ea473gryzor annually → *-01-01 00:00:00
4f372d1b10414884e2526724169d6027468ea473gryzor *:2/3 → *-*-* *:02/3:00</programlisting>
4f372d1b10414884e2526724169d6027468ea473gryzor <para>Calendar events are used by timer units, see
4f372d1b10414884e2526724169d6027468ea473gryzor <citerefentry><refentrytitle>systemd.timer</refentrytitle><manvolnum>5</manvolnum></citerefentry>
4f372d1b10414884e2526724169d6027468ea473gryzor for details.</para>
4f372d1b10414884e2526724169d6027468ea473gryzor </refsect1>
4f372d1b10414884e2526724169d6027468ea473gryzor <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
4f372d1b10414884e2526724169d6027468ea473gryzor <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
4f372d1b10414884e2526724169d6027468ea473gryzor <citerefentry><refentrytitle>systemd.timer</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
4f372d1b10414884e2526724169d6027468ea473gryzor <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
4f372d1b10414884e2526724169d6027468ea473gryzor <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>
4f372d1b10414884e2526724169d6027468ea473gryzor </refsect1>