\hypertarget{classfz_1_1datetime}{}\section{datetime Class Reference} \label{classfz_1_1datetime}\index{datetime@{datetime}} Represents a point of time in wallclock, tracking the timestamps accuracy/precision. {\ttfamily \#include $<$time.\+hpp$>$} \subsection*{Public Types} \begin{DoxyCompactItemize} \item \mbox{\Hypertarget{classfz_1_1datetime_a42a972481e6672108759c691c64066ec}\label{classfz_1_1datetime_a42a972481e6672108759c691c64066ec}} enum \mbox{\hyperlink{classfz_1_1datetime_a42a972481e6672108759c691c64066ec}{accuracy}} \+: char \{ \newline {\bfseries days}, {\bfseries hours}, {\bfseries minutes}, {\bfseries seconds}, \newline {\bfseries milliseconds} \} \begin{DoxyCompactList}\small\item\em The datetime\textquotesingle{}s accuracy. \end{DoxyCompactList}\item \mbox{\Hypertarget{classfz_1_1datetime_a828b8f8a58cd9813deb365aab404c850}\label{classfz_1_1datetime_a828b8f8a58cd9813deb365aab404c850}} enum \mbox{\hyperlink{classfz_1_1datetime_a828b8f8a58cd9813deb365aab404c850}{zone}} \{ {\bfseries utc}, {\bfseries local} \} \begin{DoxyCompactList}\small\item\em When importing or exporting a timestamp, zone is used to explicitly specify whether the conversion is to/from localtime or U\+TC. \end{DoxyCompactList}\end{DoxyCompactItemize} \subsection*{Public Member Functions} \begin{DoxyCompactItemize} \item \mbox{\Hypertarget{classfz_1_1datetime_a6e13caf9024c1a20d3aa730ed2ebfac6}\label{classfz_1_1datetime_a6e13caf9024c1a20d3aa730ed2ebfac6}} \mbox{\hyperlink{classfz_1_1datetime_a6e13caf9024c1a20d3aa730ed2ebfac6}{datetime}} ()=default \begin{DoxyCompactList}\small\item\em A default-\/constructed timestamp is \mbox{\hyperlink{classfz_1_1datetime_a644718bb2fb240de962dc3c9a1fdf0dc}{empty()}} \end{DoxyCompactList}\item \mbox{\Hypertarget{classfz_1_1datetime_a9877b80cfd199acb5acfdd2b1c5f1758}\label{classfz_1_1datetime_a9877b80cfd199acb5acfdd2b1c5f1758}} {\bfseries datetime} (\mbox{\hyperlink{classfz_1_1datetime_a828b8f8a58cd9813deb365aab404c850}{zone}} z, int year, int month, int day, int hour=-\/1, int minute=-\/1, int second=-\/1, int millisecond=-\/1) \item \mbox{\Hypertarget{classfz_1_1datetime_a626e12b2278aa72bd332332bb6f635ae}\label{classfz_1_1datetime_a626e12b2278aa72bd332332bb6f635ae}} {\bfseries datetime} (time\+\_\+t, \mbox{\hyperlink{classfz_1_1datetime_a42a972481e6672108759c691c64066ec}{accuracy}} a) \item \mbox{\hyperlink{classfz_1_1datetime_aefd49918c1de33e9ad2d9b0631ab36bb}{datetime}} (std\+::string\+\_\+view const \&s, \mbox{\hyperlink{classfz_1_1datetime_a828b8f8a58cd9813deb365aab404c850}{zone}} z) \begin{DoxyCompactList}\small\item\em Construct from string, looks for {\ttfamily Y\+Y\+Y\+Ymm\+DD}\mbox{[}\mbox{[}\mbox{[}\mbox{[}HH\mbox{]}MM\mbox{]}SS\mbox{]}sss\mbox{]}. \end{DoxyCompactList}\item \mbox{\Hypertarget{classfz_1_1datetime_aac48b5c755b1a2b4eaf886e20ea2d682}\label{classfz_1_1datetime_aac48b5c755b1a2b4eaf886e20ea2d682}} {\bfseries datetime} (std\+::wstring\+\_\+view const \&s, \mbox{\hyperlink{classfz_1_1datetime_a828b8f8a58cd9813deb365aab404c850}{zone}} z) \item \mbox{\Hypertarget{classfz_1_1datetime_a7fbc90a1db7acd4344b8982dba814eb4}\label{classfz_1_1datetime_a7fbc90a1db7acd4344b8982dba814eb4}} \mbox{\hyperlink{classfz_1_1datetime_a7fbc90a1db7acd4344b8982dba814eb4}{datetime}} (F\+I\+L\+E\+T\+I\+ME const \&ft, \mbox{\hyperlink{classfz_1_1datetime_a42a972481e6672108759c691c64066ec}{accuracy}} a) \begin{DoxyCompactList}\small\item\em Windows-\/only\+: Construct from F\+I\+L\+E\+T\+I\+ME. \end{DoxyCompactList}\item \mbox{\Hypertarget{classfz_1_1datetime_afc9530295e14084a890ac4f49187aaea}\label{classfz_1_1datetime_afc9530295e14084a890ac4f49187aaea}} {\bfseries datetime} (\mbox{\hyperlink{classfz_1_1datetime}{datetime}} const \&op)=default \item \mbox{\Hypertarget{classfz_1_1datetime_ab39abf0082e4bfbad6038720d0969ce2}\label{classfz_1_1datetime_ab39abf0082e4bfbad6038720d0969ce2}} {\bfseries datetime} (\mbox{\hyperlink{classfz_1_1datetime}{datetime}} \&\&op) noexcept=default \item \mbox{\Hypertarget{classfz_1_1datetime_a7da12117fd3925d61fea53a26946eb8d}\label{classfz_1_1datetime_a7da12117fd3925d61fea53a26946eb8d}} \mbox{\hyperlink{classfz_1_1datetime}{datetime}} \& {\bfseries operator=} (\mbox{\hyperlink{classfz_1_1datetime}{datetime}} const \&op)=default \item \mbox{\Hypertarget{classfz_1_1datetime_a53e6291b12f54642fb314acd2456a016}\label{classfz_1_1datetime_a53e6291b12f54642fb314acd2456a016}} \mbox{\hyperlink{classfz_1_1datetime}{datetime}} \& {\bfseries operator=} (\mbox{\hyperlink{classfz_1_1datetime}{datetime}} \&\&op) noexcept=default \item bool \mbox{\hyperlink{classfz_1_1datetime_a644718bb2fb240de962dc3c9a1fdf0dc}{empty}} () const \item \mbox{\Hypertarget{classfz_1_1datetime_a67b76affb3b5d35fa419ac234144038b}\label{classfz_1_1datetime_a67b76affb3b5d35fa419ac234144038b}} {\bfseries operator bool} () const \item \mbox{\Hypertarget{classfz_1_1datetime_ac8bb3912a3ce86b15842e79d0b421204}\label{classfz_1_1datetime_ac8bb3912a3ce86b15842e79d0b421204}} void \mbox{\hyperlink{classfz_1_1datetime_ac8bb3912a3ce86b15842e79d0b421204}{clear}} () \begin{DoxyCompactList}\small\item\em Resulting timestamp is \mbox{\hyperlink{classfz_1_1datetime_a644718bb2fb240de962dc3c9a1fdf0dc}{empty()}} \end{DoxyCompactList}\item \mbox{\Hypertarget{classfz_1_1datetime_a5da9de2d125841abe88dc7644dd0330e}\label{classfz_1_1datetime_a5da9de2d125841abe88dc7644dd0330e}} \mbox{\hyperlink{classfz_1_1datetime_a42a972481e6672108759c691c64066ec}{accuracy}} {\bfseries get\+\_\+accuracy} () const \item int \mbox{\hyperlink{classfz_1_1datetime_ac8d74e72f5c98c9b3d3345ef8f4f4ee4}{compare}} (\mbox{\hyperlink{classfz_1_1datetime}{datetime}} const \&op) const \begin{DoxyCompactList}\small\item\em Accuracy-\/aware comparison against another timestamp. \end{DoxyCompactList}\item \mbox{\Hypertarget{classfz_1_1datetime_ac7ad13d83a07e98cdf5365a5f163da41}\label{classfz_1_1datetime_ac7ad13d83a07e98cdf5365a5f163da41}} bool \mbox{\hyperlink{classfz_1_1datetime_ac7ad13d83a07e98cdf5365a5f163da41}{earlier\+\_\+than}} (\mbox{\hyperlink{classfz_1_1datetime}{datetime}} const \&op) const \begin{DoxyCompactList}\small\item\em Equivalent to compare(op) $<$ 0. \end{DoxyCompactList}\item \mbox{\Hypertarget{classfz_1_1datetime_a1fdeaf047d2c51da7cfe6d7007859800}\label{classfz_1_1datetime_a1fdeaf047d2c51da7cfe6d7007859800}} bool \mbox{\hyperlink{classfz_1_1datetime_a1fdeaf047d2c51da7cfe6d7007859800}{later\+\_\+than}} (\mbox{\hyperlink{classfz_1_1datetime}{datetime}} const \&op) const \begin{DoxyCompactList}\small\item\em Equivalent to compare(op) $>$ 0. \end{DoxyCompactList}\item bool \mbox{\hyperlink{classfz_1_1datetime_ac19f9555e62a21b13eaf0df85fa18dcc}{set}} (\mbox{\hyperlink{classfz_1_1datetime_a828b8f8a58cd9813deb365aab404c850}{zone}} z, int year, int month, int day, int hour=-\/1, int minute=-\/1, int second=-\/1, int millisecond=-\/1) \begin{DoxyCompactList}\small\item\em Sets the timestamp. \end{DoxyCompactList}\item bool \mbox{\hyperlink{classfz_1_1datetime_a2bc7c062a364023a562d7e1be774912d}{set}} (std\+::string\+\_\+view const \&str, \mbox{\hyperlink{classfz_1_1datetime_a828b8f8a58cd9813deb365aab404c850}{zone}} z) \begin{DoxyCompactList}\small\item\em Set from string, looks for {\ttfamily Y\+Y\+Y\+Ymm\+DD}\mbox{[}\mbox{[}\mbox{[}\mbox{[}HH\mbox{]}MM\mbox{]}SS\mbox{]}sss\mbox{]}. \end{DoxyCompactList}\item \mbox{\Hypertarget{classfz_1_1datetime_a3927d3b1ce854b8b6ea04d4abf8dcba5}\label{classfz_1_1datetime_a3927d3b1ce854b8b6ea04d4abf8dcba5}} bool {\bfseries set} (std\+::wstring\+\_\+view const \&str, \mbox{\hyperlink{classfz_1_1datetime_a828b8f8a58cd9813deb365aab404c850}{zone}} z) \item \mbox{\Hypertarget{classfz_1_1datetime_a9613e41e9cba0ad4e7613e1456c3252b}\label{classfz_1_1datetime_a9613e41e9cba0ad4e7613e1456c3252b}} bool \mbox{\hyperlink{classfz_1_1datetime_a9613e41e9cba0ad4e7613e1456c3252b}{set}} (F\+I\+L\+E\+T\+I\+ME const \&ft, \mbox{\hyperlink{classfz_1_1datetime_a42a972481e6672108759c691c64066ec}{accuracy}} a) \begin{DoxyCompactList}\small\item\em Windows-\/only\+: Set timestamp from F\+I\+L\+E\+T\+I\+ME. \end{DoxyCompactList}\item \mbox{\Hypertarget{classfz_1_1datetime_ab9513a8cd19c49357486a5673e727a95}\label{classfz_1_1datetime_ab9513a8cd19c49357486a5673e727a95}} bool \mbox{\hyperlink{classfz_1_1datetime_ab9513a8cd19c49357486a5673e727a95}{set}} (S\+Y\+S\+T\+E\+M\+T\+I\+ME const \&ft, \mbox{\hyperlink{classfz_1_1datetime_a42a972481e6672108759c691c64066ec}{accuracy}} a, \mbox{\hyperlink{classfz_1_1datetime_a828b8f8a58cd9813deb365aab404c850}{zone}} z) \begin{DoxyCompactList}\small\item\em Windows-\/only\+: Set timestamp from S\+Y\+S\+T\+E\+M\+T\+I\+ME. \end{DoxyCompactList}\item bool \mbox{\hyperlink{classfz_1_1datetime_a69cf5cefc28fa969098fced3a95e2cad}{set}} (tm \&t, \mbox{\hyperlink{classfz_1_1datetime_a42a972481e6672108759c691c64066ec}{accuracy}} a, \mbox{\hyperlink{classfz_1_1datetime_a828b8f8a58cd9813deb365aab404c850}{zone}} z) \item bool \mbox{\hyperlink{classfz_1_1datetime_a6c8b7b8b0934a0aecc5a2c430b61e792}{imbue\+\_\+time}} (int hour, int minute, int second=-\/1, int millisecond=-\/1) \begin{DoxyCompactList}\small\item\em Adds time to timestamps that only have a day-\/accuracy. \end{DoxyCompactList}\item std\+::string \mbox{\hyperlink{classfz_1_1datetime_a995d5b4d0fd77c2753997cf98581d9f3}{format}} (std\+::string const \&format, \mbox{\hyperlink{classfz_1_1datetime_a828b8f8a58cd9813deb365aab404c850}{zone}} z) const \item \mbox{\Hypertarget{classfz_1_1datetime_aefdfe32216232fada7639bf3c0512aab}\label{classfz_1_1datetime_aefdfe32216232fada7639bf3c0512aab}} std\+::wstring {\bfseries format} (std\+::wstring const \&format, \mbox{\hyperlink{classfz_1_1datetime_a828b8f8a58cd9813deb365aab404c850}{zone}} z) const \item \mbox{\Hypertarget{classfz_1_1datetime_a08b984f8e78d88f53e0c6737a3b7939f}\label{classfz_1_1datetime_a08b984f8e78d88f53e0c6737a3b7939f}} int \mbox{\hyperlink{classfz_1_1datetime_a08b984f8e78d88f53e0c6737a3b7939f}{get\+\_\+milliseconds}} () const \begin{DoxyCompactList}\small\item\em Get millisecond part of timestamp. \end{DoxyCompactList}\item \mbox{\Hypertarget{classfz_1_1datetime_a6696323ea65504df338fabf986120710}\label{classfz_1_1datetime_a6696323ea65504df338fabf986120710}} time\+\_\+t \mbox{\hyperlink{classfz_1_1datetime_a6696323ea65504df338fabf986120710}{get\+\_\+time\+\_\+t}} () const \begin{DoxyCompactList}\small\item\em Get timestamp as time\+\_\+t, seconds since 1970-\/01-\/01 00\+:00\+:00. \end{DoxyCompactList}\item tm \mbox{\hyperlink{classfz_1_1datetime_a61e2b1994947453ee7a26ccdbe72125c}{get\+\_\+tm}} (\mbox{\hyperlink{classfz_1_1datetime_a828b8f8a58cd9813deb365aab404c850}{zone}} z) const \begin{DoxyCompactList}\small\item\em Get timestamp as struct tm. \end{DoxyCompactList}\item \mbox{\Hypertarget{classfz_1_1datetime_a0409bea2dbbff658c5e9a14622345e2a}\label{classfz_1_1datetime_a0409bea2dbbff658c5e9a14622345e2a}} F\+I\+L\+E\+T\+I\+ME \mbox{\hyperlink{classfz_1_1datetime_a0409bea2dbbff658c5e9a14622345e2a}{get\+\_\+filetime}} () const \begin{DoxyCompactList}\small\item\em Windows-\/only\+: Get timestamp as F\+I\+L\+E\+T\+I\+ME. \end{DoxyCompactList}\item std\+::string \mbox{\hyperlink{classfz_1_1datetime_acac239c4fdf86efb377e9f496f671737}{get\+\_\+rfc822}} () const \item bool \mbox{\hyperlink{classfz_1_1datetime_addc63c1cb4a66c2f0d1402ac5f358a2b}{set\+\_\+rfc822}} (std\+::string\+\_\+view const \&str) \item \mbox{\Hypertarget{classfz_1_1datetime_ac3c728aad7c3517167a6066b76d11926}\label{classfz_1_1datetime_ac3c728aad7c3517167a6066b76d11926}} bool {\bfseries set\+\_\+rfc822} (std\+::wstring\+\_\+view const \&str) \end{DoxyCompactItemize} \begin{Indent}\textbf{ Naive comparison operators}\par {\em Naive operators compare the timestamp\textquotesingle{}s internal representation first, with accuracy as secondary criterion. \begin{DoxySeeAlso}{See also} \mbox{\hyperlink{classfz_1_1datetime_ac8d74e72f5c98c9b3d3345ef8f4f4ee4}{compare}} \end{DoxySeeAlso} }\begin{DoxyCompactItemize} \item \mbox{\Hypertarget{classfz_1_1datetime_a298383a53b647073cbb8207d909332a3}\label{classfz_1_1datetime_a298383a53b647073cbb8207d909332a3}} bool {\bfseries operator==} (\mbox{\hyperlink{classfz_1_1datetime}{datetime}} const \&op) const \item \mbox{\Hypertarget{classfz_1_1datetime_a2e0b5b7460d4483056b0a85fcd46697f}\label{classfz_1_1datetime_a2e0b5b7460d4483056b0a85fcd46697f}} bool {\bfseries operator!=} (\mbox{\hyperlink{classfz_1_1datetime}{datetime}} const \&op) const \item \mbox{\Hypertarget{classfz_1_1datetime_a1a8930fbb558f3d103dd03ae704305f2}\label{classfz_1_1datetime_a1a8930fbb558f3d103dd03ae704305f2}} bool {\bfseries operator$<$} (\mbox{\hyperlink{classfz_1_1datetime}{datetime}} const \&op) const \item \mbox{\Hypertarget{classfz_1_1datetime_a6b2f7ad7c742ffd4b4dfcb2e7335b803}\label{classfz_1_1datetime_a6b2f7ad7c742ffd4b4dfcb2e7335b803}} bool {\bfseries operator$<$=} (\mbox{\hyperlink{classfz_1_1datetime}{datetime}} const \&op) const \item \mbox{\Hypertarget{classfz_1_1datetime_aaaba1a617706de0dd8a30c9700847aac}\label{classfz_1_1datetime_aaaba1a617706de0dd8a30c9700847aac}} bool {\bfseries operator$>$} (\mbox{\hyperlink{classfz_1_1datetime}{datetime}} const \&op) const \end{DoxyCompactItemize} \end{Indent} \begin{Indent}\textbf{ Adding/subtracting duration intervals}\par {\em Adding or subracting a \mbox{\hyperlink{classfz_1_1duration}{duration}} interval is accuracy-\/aware, e.\+g. adding a single second to a datetime with minute-\/accuracy does not change the timestamp. }\begin{DoxyCompactItemize} \item \mbox{\Hypertarget{classfz_1_1datetime_a763efe0421c72b87d1b50b426c92b6e9}\label{classfz_1_1datetime_a763efe0421c72b87d1b50b426c92b6e9}} \mbox{\hyperlink{classfz_1_1datetime}{datetime}} \& {\bfseries operator+=} (\mbox{\hyperlink{classfz_1_1duration}{duration}} const \&op) \item \mbox{\Hypertarget{classfz_1_1datetime_ad4527a7147aca7ff97684e380664d9fc}\label{classfz_1_1datetime_ad4527a7147aca7ff97684e380664d9fc}} \mbox{\hyperlink{classfz_1_1datetime}{datetime}} {\bfseries operator+} (\mbox{\hyperlink{classfz_1_1duration}{duration}} const \&op) const \item \mbox{\Hypertarget{classfz_1_1datetime_abf772583f9fd9c4106159f6a7aad8e02}\label{classfz_1_1datetime_abf772583f9fd9c4106159f6a7aad8e02}} \mbox{\hyperlink{classfz_1_1datetime}{datetime}} \& {\bfseries operator-\/=} (\mbox{\hyperlink{classfz_1_1duration}{duration}} const \&op) \item \mbox{\Hypertarget{classfz_1_1datetime_a81d51b343499696f5b4c285094114f6c}\label{classfz_1_1datetime_a81d51b343499696f5b4c285094114f6c}} \mbox{\hyperlink{classfz_1_1datetime}{datetime}} {\bfseries operator-\/} (\mbox{\hyperlink{classfz_1_1duration}{duration}} const \&op) const \end{DoxyCompactItemize} \end{Indent} \subsection*{Static Public Member Functions} \begin{DoxyCompactItemize} \item \mbox{\Hypertarget{classfz_1_1datetime_a8897f075c4258c93e690fdc7c078883f}\label{classfz_1_1datetime_a8897f075c4258c93e690fdc7c078883f}} static \mbox{\hyperlink{classfz_1_1datetime}{datetime}} \mbox{\hyperlink{classfz_1_1datetime_a8897f075c4258c93e690fdc7c078883f}{now}} () \begin{DoxyCompactList}\small\item\em Returns the current date/time. \end{DoxyCompactList}\item static bool \mbox{\hyperlink{classfz_1_1datetime_acef3f3d2a021929f46b34ab13e5592bc}{verify\+\_\+format}} (std\+::string const \&fmt) \item \mbox{\Hypertarget{classfz_1_1datetime_a4fb7ec6f11149665b3b8bec6889f2baa}\label{classfz_1_1datetime_a4fb7ec6f11149665b3b8bec6889f2baa}} static bool {\bfseries verify\+\_\+format} (std\+::wstring const \&fmt) \end{DoxyCompactItemize} \subsection*{Friends} \begin{DoxyCompactItemize} \item \mbox{\hyperlink{classfz_1_1duration}{duration}} \mbox{\hyperlink{classfz_1_1datetime_a76fe3701440545b10137ed3d703ec924}{operator-\/}} (\mbox{\hyperlink{classfz_1_1datetime}{datetime}} const \&a, \mbox{\hyperlink{classfz_1_1datetime}{datetime}} const \&b) \begin{DoxyCompactList}\small\item\em Gets the difference between two timestamps as \mbox{\hyperlink{classfz_1_1duration}{duration}}. \end{DoxyCompactList}\end{DoxyCompactItemize} \subsection{Detailed Description} Represents a point of time in wallclock, tracking the timestamps accuracy/precision. As time may come from different sources that have different accuracy/precision, this class keeps track of accuracy information. For example, your local filesystem might store timestamps with milliseconds, whereas a given network protocol might only offer seconds. You can use \mbox{\hyperlink{classfz_1_1datetime_ac8d74e72f5c98c9b3d3345ef8f4f4ee4}{compare}} to easily check whether the timestamp of a local file is equivalent to a timestamp received via the protocol. The internal representation of {\ttfamily datetime} is in milliseconds since 1970-\/01-\/01 00\+:00\+:00.\+000 U\+TC and can handle a range of several million years. While datetime supports negative times (i.\+e. earlier than 1970-\/01-\/01 00\+:00\+:00.\+000 U\+TC), the underlying plaform may not support it. \begin{DoxyRemark}{Remarks} Some $\ast$nix systems base their time on T\+AI instead of U\+TC, though we pretend there is no difference, as the latter is the default on every modern distribution. \end{DoxyRemark} \begin{Desc} \item[Examples]\par \mbox{\hyperlink{list_8cpp-example}{list.\+cpp}}.\end{Desc} \subsection{Constructor \& Destructor Documentation} \mbox{\Hypertarget{classfz_1_1datetime_aefd49918c1de33e9ad2d9b0631ab36bb}\label{classfz_1_1datetime_aefd49918c1de33e9ad2d9b0631ab36bb}} \index{datetime@{datetime}!datetime@{datetime}} \index{datetime@{datetime}!datetime@{datetime}} \subsubsection{\texorpdfstring{datetime()}{datetime()}} {\footnotesize\ttfamily \mbox{\hyperlink{classfz_1_1datetime}{datetime}} (\begin{DoxyParamCaption}\item[{std\+::string\+\_\+view const \&}]{s, }\item[{\mbox{\hyperlink{classfz_1_1datetime_a828b8f8a58cd9813deb365aab404c850}{zone}}}]{z }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [explicit]}} Construct from string, looks for {\ttfamily Y\+Y\+Y\+Ymm\+DD}\mbox{[}\mbox{[}\mbox{[}\mbox{[}HH\mbox{]}MM\mbox{]}SS\mbox{]}sss\mbox{]}. \begin{DoxySeeAlso}{See also} bool \mbox{\hyperlink{classfz_1_1datetime_a2bc7c062a364023a562d7e1be774912d}{set(std\+::string\+\_\+view const\& str, zone z)}} \end{DoxySeeAlso} \subsection{Member Function Documentation} \mbox{\Hypertarget{classfz_1_1datetime_ac8d74e72f5c98c9b3d3345ef8f4f4ee4}\label{classfz_1_1datetime_ac8d74e72f5c98c9b3d3345ef8f4f4ee4}} \index{datetime@{datetime}!compare@{compare}} \index{compare@{compare}!datetime@{datetime}} \subsubsection{\texorpdfstring{compare()}{compare()}} {\footnotesize\ttfamily int compare (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{classfz_1_1datetime}{datetime}} const \&}]{op }\end{DoxyParamCaption}) const} Accuracy-\/aware comparison against another timestamp. Conceptually it works as if naively comparing both timestamps after truncating/clamping them to the least common accuracy. \begin{DoxyReturn}{Returns} 0 if timestamps are equivalent,~\newline $<$0 if own timestamp is earlier than the argument,~\newline $>$0 if own timestamp is late than the argument. \end{DoxyReturn} \mbox{\Hypertarget{classfz_1_1datetime_a644718bb2fb240de962dc3c9a1fdf0dc}\label{classfz_1_1datetime_a644718bb2fb240de962dc3c9a1fdf0dc}} \index{datetime@{datetime}!empty@{empty}} \index{empty@{empty}!datetime@{datetime}} \subsubsection{\texorpdfstring{empty()}{empty()}} {\footnotesize\ttfamily bool empty (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const} \begin{DoxyReturn}{Returns} {\ttfamily true} if no timestamp has been set \end{DoxyReturn} \begin{Desc} \item[Examples]\par \mbox{\hyperlink{list_8cpp-example}{list.\+cpp}}.\end{Desc} \mbox{\Hypertarget{classfz_1_1datetime_a995d5b4d0fd77c2753997cf98581d9f3}\label{classfz_1_1datetime_a995d5b4d0fd77c2753997cf98581d9f3}} \index{datetime@{datetime}!format@{format}} \index{format@{format}!datetime@{datetime}} \subsubsection{\texorpdfstring{format()}{format()}} {\footnotesize\ttfamily std\+::string format (\begin{DoxyParamCaption}\item[{std\+::string const \&}]{format, }\item[{\mbox{\hyperlink{classfz_1_1datetime_a828b8f8a58cd9813deb365aab404c850}{zone}}}]{z }\end{DoxyParamCaption}) const} Format time as string \begin{DoxyParams}{Parameters} {\em format} & is a format string as understood by \+::strftime\\ \hline \end{DoxyParams} Note that some format specifiers are locale-\/dependent. \begin{Desc} \item[Examples]\par \mbox{\hyperlink{list_8cpp-example}{list.\+cpp}}.\end{Desc} \mbox{\Hypertarget{classfz_1_1datetime_acac239c4fdf86efb377e9f496f671737}\label{classfz_1_1datetime_acac239c4fdf86efb377e9f496f671737}} \index{datetime@{datetime}!get\_rfc822@{get\_rfc822}} \index{get\_rfc822@{get\_rfc822}!datetime@{datetime}} \subsubsection{\texorpdfstring{get\_rfc822()}{get\_rfc822()}} {\footnotesize\ttfamily std\+::string get\+\_\+rfc822 (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const} Returns date in the format specified in R\+FC 822, updated by R\+FC 1123. \begin{DoxyParagraph}{Example\+:} \begin{DoxyItemize} \item Sun, 06 Nov 1994 08\+:49\+:37 G\+MT \end{DoxyItemize} \end{DoxyParagraph} \mbox{\Hypertarget{classfz_1_1datetime_a61e2b1994947453ee7a26ccdbe72125c}\label{classfz_1_1datetime_a61e2b1994947453ee7a26ccdbe72125c}} \index{datetime@{datetime}!get\_tm@{get\_tm}} \index{get\_tm@{get\_tm}!datetime@{datetime}} \subsubsection{\texorpdfstring{get\_tm()}{get\_tm()}} {\footnotesize\ttfamily tm get\+\_\+tm (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{classfz_1_1datetime_a828b8f8a58cd9813deb365aab404c850}{zone}}}]{z }\end{DoxyParamCaption}) const} Get timestamp as struct tm. Undefined if datetime is empty. \mbox{\Hypertarget{classfz_1_1datetime_a6c8b7b8b0934a0aecc5a2c430b61e792}\label{classfz_1_1datetime_a6c8b7b8b0934a0aecc5a2c430b61e792}} \index{datetime@{datetime}!imbue\_time@{imbue\_time}} \index{imbue\_time@{imbue\_time}!datetime@{datetime}} \subsubsection{\texorpdfstring{imbue\_time()}{imbue\_time()}} {\footnotesize\ttfamily bool imbue\+\_\+time (\begin{DoxyParamCaption}\item[{int}]{hour, }\item[{int}]{minute, }\item[{int}]{second = {\ttfamily -\/1}, }\item[{int}]{millisecond = {\ttfamily -\/1} }\end{DoxyParamCaption})} Adds time to timestamps that only have a day-\/accuracy. Changes accuracy based on given parameters. Use -\/1 in parameters that aren\textquotesingle{}t used. \begin{DoxyReturn}{Returns} Whether the function succeeded. On failure object remains unchanged. \end{DoxyReturn} \mbox{\Hypertarget{classfz_1_1datetime_ac19f9555e62a21b13eaf0df85fa18dcc}\label{classfz_1_1datetime_ac19f9555e62a21b13eaf0df85fa18dcc}} \index{datetime@{datetime}!set@{set}} \index{set@{set}!datetime@{datetime}} \subsubsection{\texorpdfstring{set()}{set()}\hspace{0.1cm}{\footnotesize\ttfamily [1/3]}} {\footnotesize\ttfamily bool set (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{classfz_1_1datetime_a828b8f8a58cd9813deb365aab404c850}{zone}}}]{z, }\item[{int}]{year, }\item[{int}]{month, }\item[{int}]{day, }\item[{int}]{hour = {\ttfamily -\/1}, }\item[{int}]{minute = {\ttfamily -\/1}, }\item[{int}]{second = {\ttfamily -\/1}, }\item[{int}]{millisecond = {\ttfamily -\/1} }\end{DoxyParamCaption})} Sets the timestamp. \begin{DoxyParams}{Parameters} {\em month} & 1-\/indexed as on a calender, e.\+g. February is 2 \\ \hline {\em day} & 1-\/indexed as on a calender \\ \hline {\em hour} & 0-\/indexed as on a 24h clock\\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} whether setting the timestamp succeeded. On failure object gets cleared \end{DoxyReturn} \mbox{\Hypertarget{classfz_1_1datetime_a2bc7c062a364023a562d7e1be774912d}\label{classfz_1_1datetime_a2bc7c062a364023a562d7e1be774912d}} \index{datetime@{datetime}!set@{set}} \index{set@{set}!datetime@{datetime}} \subsubsection{\texorpdfstring{set()}{set()}\hspace{0.1cm}{\footnotesize\ttfamily [2/3]}} {\footnotesize\ttfamily bool set (\begin{DoxyParamCaption}\item[{std\+::string\+\_\+view const \&}]{str, }\item[{\mbox{\hyperlink{classfz_1_1datetime_a828b8f8a58cd9813deb365aab404c850}{zone}}}]{z }\end{DoxyParamCaption})} Set from string, looks for {\ttfamily Y\+Y\+Y\+Ymm\+DD}\mbox{[}\mbox{[}\mbox{[}\mbox{[}HH\mbox{]}MM\mbox{]}SS\mbox{]}sss\mbox{]}. Ignores all non-\/digit characters between fields. For example 20140720T165432 is the same as 2014-\/07-\/20 16\+:54\+:32 \mbox{\hyperlink{classfz_1_1datetime_a42a972481e6672108759c691c64066ec}{accuracy}} is set according to the fields present in the string. \begin{DoxyReturn}{Returns} whether setting the timestamp succeeded. On failure object gets cleared \end{DoxyReturn} \mbox{\Hypertarget{classfz_1_1datetime_a69cf5cefc28fa969098fced3a95e2cad}\label{classfz_1_1datetime_a69cf5cefc28fa969098fced3a95e2cad}} \index{datetime@{datetime}!set@{set}} \index{set@{set}!datetime@{datetime}} \subsubsection{\texorpdfstring{set()}{set()}\hspace{0.1cm}{\footnotesize\ttfamily [3/3]}} {\footnotesize\ttfamily bool set (\begin{DoxyParamCaption}\item[{tm \&}]{t, }\item[{\mbox{\hyperlink{classfz_1_1datetime_a42a972481e6672108759c691c64066ec}{accuracy}}}]{a, }\item[{\mbox{\hyperlink{classfz_1_1datetime_a828b8f8a58cd9813deb365aab404c850}{zone}}}]{z }\end{DoxyParamCaption})} Sets timestamp from struct tm. \begin{DoxyNote}{Note} Not available on Windows. \end{DoxyNote} \begin{DoxyWarning}{Warning} modifies passed structure \end{DoxyWarning} \begin{DoxyReturn}{Returns} {\ttfamily true} on success, {\ttfamily false} on failure. The object is empty after failure. \end{DoxyReturn} \mbox{\Hypertarget{classfz_1_1datetime_addc63c1cb4a66c2f0d1402ac5f358a2b}\label{classfz_1_1datetime_addc63c1cb4a66c2f0d1402ac5f358a2b}} \index{datetime@{datetime}!set\_rfc822@{set\_rfc822}} \index{set\_rfc822@{set\_rfc822}!datetime@{datetime}} \subsubsection{\texorpdfstring{set\_rfc822()}{set\_rfc822()}} {\footnotesize\ttfamily bool set\+\_\+rfc822 (\begin{DoxyParamCaption}\item[{std\+::string\+\_\+view const \&}]{str }\end{DoxyParamCaption})} Parses a date in the format specified in R\+FC 822, either original or updated by R\+FC 1123. Also supports R\+FC 850 and A\+N\+SI C asctime formats. Used timezone is always U\+TC. On errors, object gets clears \begin{DoxyReturn}{Returns} whether setting the timestamp succeeded. On failure object gets cleared. \end{DoxyReturn} \begin{DoxyParagraph}{Examples\+:} Sun, 06 Nov 1994 08\+:49\+:37 G\+MT // R\+FC 822, updated by R\+FC 1123~\newline Sun, 06-\/Nov-\/94 08\+:49\+:37 G\+MT // obsolete R\+FC 850~\newline Sun Nov 6 08\+:49\+:37 1994 // A\+N\+SI C asctime~\newline \end{DoxyParagraph} \mbox{\Hypertarget{classfz_1_1datetime_acef3f3d2a021929f46b34ab13e5592bc}\label{classfz_1_1datetime_acef3f3d2a021929f46b34ab13e5592bc}} \index{datetime@{datetime}!verify\_format@{verify\_format}} \index{verify\_format@{verify\_format}!datetime@{datetime}} \subsubsection{\texorpdfstring{verify\_format()}{verify\_format()}} {\footnotesize\ttfamily static bool verify\+\_\+format (\begin{DoxyParamCaption}\item[{std\+::string const \&}]{fmt }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}} Verify format strings \begin{DoxyParams}{Parameters} {\em fmt} & the string that is to be tested \\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} whether the passed string is a format string understood by \+::strftime \end{DoxyReturn} \subsection{Friends And Related Function Documentation} \mbox{\Hypertarget{classfz_1_1datetime_a76fe3701440545b10137ed3d703ec924}\label{classfz_1_1datetime_a76fe3701440545b10137ed3d703ec924}} \index{datetime@{datetime}!operator-\/@{operator-\/}} \index{operator-\/@{operator-\/}!datetime@{datetime}} \subsubsection{\texorpdfstring{operator-\/}{operator-}} {\footnotesize\ttfamily \mbox{\hyperlink{classfz_1_1duration}{duration}} operator-\/ (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{classfz_1_1datetime}{datetime}} const \&}]{a, }\item[{\mbox{\hyperlink{classfz_1_1datetime}{datetime}} const \&}]{b }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [friend]}} Gets the difference between two timestamps as \mbox{\hyperlink{classfz_1_1duration}{duration}}. This function ignores accuracy, it treats both timestamps as if they had millisecond-\/accuracy. The documentation for this class was generated from the following file\+:\begin{DoxyCompactItemize} \item \mbox{\hyperlink{time_8hpp}{time.\+hpp}}\end{DoxyCompactItemize}