<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Class Poco::Timestamp</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <meta name="author" content="Applied Informatics Software Engineering GmbH and Contributors"/> <meta name="publisher" content="Applied Informatics Software Engineering GmbH and Contributors"/> <meta name="copyright" content="Copyright (c) 2009, Applied Informatics Software Engineering GmbH and Contributors"/> <meta name="language" content="en"/> <meta name="date" content="2009-11-24"/> <meta name="generator" content="PocoDoc"/> <link rel="stylesheet" href="css/styles.css" type="text/css"/> </head> <body bgcolor="#ffffff" leftmargin="0" topmargin="0"> <div class="header"> <h1 class="namespace"><a href="Poco.html" class="namespace">Poco</a></h1> <h1 class="symbol">class Timestamp</h1> </div> <div class="body"> <p> <b>Library:</b> Foundation<br /> <b>Package:</b> DateTime<br /> <b>Header:</b> Poco/Timestamp.h</p> <h2>Description</h2> <div class="description"> <p>A <a href="Poco.Timestamp.html" title="class Poco::Timestamp">Timestamp</a> stores a monotonic* time value with (theoretical) microseconds resolution. Timestamps can be compared with each other and simple arithmetics are supported. </p> <p>[*] Note that <a href="Poco.Timestamp.html" title="class Poco::Timestamp">Timestamp</a> values are only monotonic as long as the systems's clock is monotonic as well (and not, e.g. set back). </p> <p>Timestamps are UTC (Coordinated Universal Time) based and thus independent of the timezone in effect on the system. </p> </div> <h2>Member Summary</h2> <p><b>Member Functions: </b><a href="Poco.Timestamp.html#11190" title="Poco::Timestamp::elapsed()">elapsed</a>, <a href="Poco.Timestamp.html#11189" title="Poco::Timestamp::epochMicroseconds()">epochMicroseconds</a>, <a href="Poco.Timestamp.html#11187" title="Poco::Timestamp::epochTime()">epochTime</a>, <a href="Poco.Timestamp.html#11193" title="Poco::Timestamp::fromEpochTime()">fromEpochTime</a>, <a href="Poco.Timestamp.html#11195" title="Poco::Timestamp::fromUtcTime()">fromUtcTime</a>, <a href="Poco.Timestamp.html#11191" title="Poco::Timestamp::isElapsed()">isElapsed</a>, <a href="Poco.Timestamp.html#11167" title="Poco::Timestamp::operator !=()">operator !=</a>, <a href="Poco.Timestamp.html#11177" title="Poco::Timestamp::operator +()">operator +</a>, <a href="Poco.Timestamp.html#11183" title="Poco::Timestamp::operator +=()">operator +=</a>, <a href="Poco.Timestamp.html#11179" title="Poco::Timestamp::operator -()">operator -</a>, <a href="Poco.Timestamp.html#11185" title="Poco::Timestamp::operator -=()">operator -=</a>, <a href="Poco.Timestamp.html#11173" title="Poco::Timestamp::operator <()">operator <</a>, <a href="Poco.Timestamp.html#11175" title="Poco::Timestamp::operator <=()">operator <=</a>, <a href="Poco.Timestamp.html#11158" title="Poco::Timestamp::operator =()">operator =</a>, <a href="Poco.Timestamp.html#11165" title="Poco::Timestamp::operator ==()">operator ==</a>, <a href="Poco.Timestamp.html#11169" title="Poco::Timestamp::operator >()">operator ></a>, <a href="Poco.Timestamp.html#11171" title="Poco::Timestamp::operator >=()">operator >=</a>, <a href="Poco.Timestamp.html#11197" title="Poco::Timestamp::resolution()">resolution</a>, <a href="Poco.Timestamp.html#11162" title="Poco::Timestamp::swap()">swap</a>, <a href="Poco.Timestamp.html#11164" title="Poco::Timestamp::update()">update</a>, <a href="Poco.Timestamp.html#11188" title="Poco::Timestamp::utcTime()">utcTime</a></p> <h2>Types</h2> <h3><a name="11151">TimeDiff</a></h3> <p class="decl">typedef <a href="Poco.html#11357" title="Poco::Int64">Int64</a> <a href="Poco.Timestamp.html#11151" title="Poco::Timestamp::TimeDiff">TimeDiff</a>;</p> <div class="description"> <p>difference between two timestamps in microseconds </p> </div> <h3><a name="11149">TimeVal</a></h3> <p class="decl">typedef <a href="Poco.html#11357" title="Poco::Int64">Int64</a> <a href="Poco.Timestamp.html#11149" title="Poco::Timestamp::TimeVal">TimeVal</a>;</p> <div class="description"> <p>monotonic UTC time value in microsecond resolution </p> </div> <h3><a name="11150">UtcTimeVal</a></h3> <p class="decl">typedef <a href="Poco.html#11357" title="Poco::Int64">Int64</a> <a href="Poco.Timestamp.html#11150" title="Poco::Timestamp::UtcTimeVal">UtcTimeVal</a>;</p> <div class="description"> <p>monotonic UTC time value in 100 nanosecond resolution </p> </div> <h2>Constructors</h2> <h3><a name="11152">Timestamp</a></h3> <p class="decl"><a href="Poco.Timestamp.html" title="class Poco::Timestamp">Timestamp</a>();</p> <div class="description"> <p>Creates a timestamp with the current time. </p> </div> <h3><a name="11153">Timestamp</a></h3> <p class="decl"><a href="Poco.Timestamp.html" title="class Poco::Timestamp">Timestamp</a>(<br /> <a href="Poco.Timestamp.html#11149" title="Poco::Timestamp::TimeVal">TimeVal</a> tv<br />);</p> <div class="description"> <p>Creates a timestamp from the given time value. </p> </div> <h3><a name="11155">Timestamp</a></h3> <p class="decl"><a href="Poco.Timestamp.html" title="class Poco::Timestamp">Timestamp</a>(<br /> const <a href="Poco.Timestamp.html" title="class Poco::Timestamp">Timestamp</a> & other<br />);</p> <div class="description"> <p>Copy constructor. </p> </div> <h2>Destructor</h2> <h3><a name="11157">~Timestamp</a></h3> <p class="decl">~<a href="Poco.Timestamp.html" title="class Poco::Timestamp">Timestamp</a>();</p> <div class="description"> <p>Destroys the timestamp </p> </div> <h2>Member Functions</h2> <h3><a name="11190">elapsed</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl"><a href="Poco.Timestamp.html#11151" title="Poco::Timestamp::TimeDiff">TimeDiff</a> elapsed() const;</p> <div class="description"> <p>Returns the time elapsed since the time denoted by the timestamp. Equivalent to <a href="Poco.Timestamp.html" title="class Poco::Timestamp">Timestamp</a>() - *this. </p> </div> <h3><a name="11189">epochMicroseconds</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl"><a href="Poco.Timestamp.html#11149" title="Poco::Timestamp::TimeVal">TimeVal</a> epochMicroseconds() const;</p> <div class="description"> <p>Returns the timestamp expressed in microseconds since the Unix epoch, midnight, January 1, 1970. </p> </div> <h3><a name="11187">epochTime</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">std::time_t epochTime() const;</p> <div class="description"> <p>Returns the timestamp expressed in time_t. time_t base time is midnight, January 1, 1970. Resolution is one second. </p> </div> <h3><a name="11193">fromEpochTime</a> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">static <a href="Poco.Timestamp.html" title="class Poco::Timestamp">Timestamp</a> fromEpochTime(<br /> std::time_t t<br />);</p> <div class="description"> <p>Creates a timestamp from a std::time_t. </p> </div> <h3><a name="11195">fromUtcTime</a> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">static <a href="Poco.Timestamp.html" title="class Poco::Timestamp">Timestamp</a> fromUtcTime(<br /> <a href="Poco.Timestamp.html#11150" title="Poco::Timestamp::UtcTimeVal">UtcTimeVal</a> val<br />);</p> <div class="description"> <p>Creates a timestamp from a UTC time value. </p> </div> <h3><a name="11191">isElapsed</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">bool isElapsed(<br /> <a href="Poco.Timestamp.html#11151" title="Poco::Timestamp::TimeDiff">TimeDiff</a> interval<br />) const;</p> <div class="description"> <p>Returns true if and only if the given interval has passed since the time denoted by the timestamp. </p> </div> <h3><a name="11167">operator !=</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">bool operator != (<br /> const <a href="Poco.Timestamp.html" title="class Poco::Timestamp">Timestamp</a> & ts<br />) const;</p> <div class="description"> <p></p> </div> <h3><a name="11177">operator +</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl"><a href="Poco.Timestamp.html" title="class Poco::Timestamp">Timestamp</a> operator + (<br /> <a href="Poco.Timestamp.html#11151" title="Poco::Timestamp::TimeDiff">TimeDiff</a> d<br />) const;</p> <div class="description"> <p></p> </div> <h3><a name="11183">operator +=</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl"><a href="Poco.Timestamp.html" title="class Poco::Timestamp">Timestamp</a> & operator += (<br /> <a href="Poco.Timestamp.html#11151" title="Poco::Timestamp::TimeDiff">TimeDiff</a> d<br />);</p> <div class="description"> <p></p> </div> <h3><a name="11179">operator -</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl"><a href="Poco.Timestamp.html" title="class Poco::Timestamp">Timestamp</a> operator - (<br /> <a href="Poco.Timestamp.html#11151" title="Poco::Timestamp::TimeDiff">TimeDiff</a> d<br />) const;</p> <div class="description"> <p></p> </div> <h3><a name="11181">operator -</a></h3> <p class="decl"><a href="Poco.Timestamp.html#11151" title="Poco::Timestamp::TimeDiff">TimeDiff</a> operator - (<br /> const <a href="Poco.Timestamp.html" title="class Poco::Timestamp">Timestamp</a> & ts<br />) const;</p> <div class="description"> <p></p> </div> <h3><a name="11185">operator -=</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl"><a href="Poco.Timestamp.html" title="class Poco::Timestamp">Timestamp</a> & operator -= (<br /> <a href="Poco.Timestamp.html#11151" title="Poco::Timestamp::TimeDiff">TimeDiff</a> d<br />);</p> <div class="description"> <p></p> </div> <h3><a name="11173">operator <</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">bool operator < (<br /> const <a href="Poco.Timestamp.html" title="class Poco::Timestamp">Timestamp</a> & ts<br />) const;</p> <div class="description"> <p></p> </div> <h3><a name="11175">operator <=</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">bool operator <= (<br /> const <a href="Poco.Timestamp.html" title="class Poco::Timestamp">Timestamp</a> & ts<br />) const;</p> <div class="description"> <p></p> </div> <h3><a name="11158">operator =</a></h3> <p class="decl"><a href="Poco.Timestamp.html" title="class Poco::Timestamp">Timestamp</a> & operator = (<br /> const <a href="Poco.Timestamp.html" title="class Poco::Timestamp">Timestamp</a> & other<br />);</p> <div class="description"> <p></p> </div> <h3><a name="11160">operator =</a></h3> <p class="decl"><a href="Poco.Timestamp.html" title="class Poco::Timestamp">Timestamp</a> & operator = (<br /> <a href="Poco.Timestamp.html#11149" title="Poco::Timestamp::TimeVal">TimeVal</a> tv<br />);</p> <div class="description"> <p></p> </div> <h3><a name="11165">operator ==</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">bool operator == (<br /> const <a href="Poco.Timestamp.html" title="class Poco::Timestamp">Timestamp</a> & ts<br />) const;</p> <div class="description"> <p></p> </div> <h3><a name="11169">operator ></a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">bool operator > (<br /> const <a href="Poco.Timestamp.html" title="class Poco::Timestamp">Timestamp</a> & ts<br />) const;</p> <div class="description"> <p></p> </div> <h3><a name="11171">operator >=</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">bool operator >= (<br /> const <a href="Poco.Timestamp.html" title="class Poco::Timestamp">Timestamp</a> & ts<br />) const;</p> <div class="description"> <p></p> </div> <h3><a name="11197">resolution</a> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">static <a href="Poco.Timestamp.html#11149" title="Poco::Timestamp::TimeVal">TimeVal</a> resolution();</p> <div class="description"> <p>Returns the resolution in units per second. Since the timestamp has microsecond resolution, the returned value is always 1000000. </p> </div> <h3><a name="11162">swap</a></h3> <p class="decl">void swap(<br /> <a href="Poco.Timestamp.html" title="class Poco::Timestamp">Timestamp</a> & timestamp<br />);</p> <div class="description"> <p>Swaps the <a href="Poco.Timestamp.html" title="class Poco::Timestamp">Timestamp</a> with another one. </p> </div> <h3><a name="11164">update</a></h3> <p class="decl">void update();</p> <div class="description"> <p>Updates the <a href="Poco.Timestamp.html" title="class Poco::Timestamp">Timestamp</a> with the current time. </p> </div> <h3><a name="11188">utcTime</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl"><a href="Poco.Timestamp.html#11150" title="Poco::Timestamp::UtcTimeVal">UtcTimeVal</a> utcTime() const;</p> <div class="description"> <p>Returns the timestamp expressed in UTC-based time. UTC base time is midnight, October 15, 1582. Resolution is 100 nanoseconds. </p> </div> <p class="footer">POCO C++ Libraries 1.3.6-all<br /> Copyright © 2009, <a href="http://pocoproject.org/" target="_blank">Applied Informatics Software Engineering GmbH and Contributors</a></p> </div> </body> </html>