⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 time.html

📁 PTypes (C++ Portable Types Library) is a simple alternative to the STL that includes multithreading
💻 HTML
字号:
<html><!-- #BeginTemplate "/Templates/tmpl.dwt" --><head><!-- #BeginEditable "doctitle" --> <title>PTypes: date/time: </title><!-- #EndEditable --> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link rel="stylesheet" href="styles.css"></head><body bgcolor="#FFFFFF" leftmargin="40" marginwidth="40"><p><a href="../index.html"><img src="title-1.7.gif" width="213" height="34" alt="C++ Portable Types Library (PTypes) Version 1.7" border="0"></a> <hr noshade><!-- #BeginEditable "body" --> <p class="hpath"><a href="index.html">Top</a>: <a href="basic.html">Basic types</a>: Date/time: </p><ul><li> <h5><a href="time.datetime.html">Datetime type</a></h5></li><li> <h5><a href="time.calendar.html">Date/calendar manipulation</a></h5></li><li> <h5><a href="time.time.html">Time manipulation</a></h5></li></ul><p>The <span class="lang">datetime</span> data type and the accompanying utilities provide portable (system-independent) means of calendar and time manipulation. <span class="lang">Datetime</span> is equivalent to signed 64-bit integer type (<span class="lang">large</span> type in PTypes) which holds a time value with a millisecond precision in the range of dates 01/01/0001 through 12/31/9999. The value of a datetime variable represents the number of milliseconds since the beginning of the calendar, i.e. midnight January 1st, year 1. The upper limit is caused by the fact that the leap year rule may (and most likely will) change after the year 10000.</p><p>Variables of type <span class="lang">datetime</span> can be used in various ways: as a date/time stamp, as a difference between two events in the range from 1 millisecond up to 10,000 years, as a date alone without the time (e.g. for calendar manipulation), as a time value alone, etc.</p><p>The date/time manipulation functions are divided into 3 groups in this documentation: <a href="time.datetime.html">general</a>, <a href="time.calendar.html">date/calendar</a> and <a href="time.time.html">time</a>. Most of these functions work with parameters of type <span class="lang">datetime</span>. The prototypes and other declarations are in the header file <span class="lang">&lt;ptime.h&gt;</span>. </p><p>Here are some examples of using <span class="lang">datetime</span> and the accompanying utilities:</p><blockquote> <pre>#include &lt;pasync.h&gt;    <span class="comment">// for psleep()</span>#include &lt;ptime.h&gt;USING_PTYPESint main(){    <span class="comment">// PTypes' birthday (birth moment, if you wish)</span>    datetime d = encodedate(2000, 3, 30) + encodetime(13, 24, 58, 995);    pout.putf("PTypes' birth moment: %s\n", dttostring(d, "%c"));        <span class="comment">// now see how old is PTypes in milliseconds</span>    datetime diff = now() - d;    int hours, mins, secs, msecs;    decodetime(diff, hours, mins, secs, msecs);    pout.putf("PTypes' life time: %d hours %d minutes %d seconds and %d milliseconds\n",        days(diff) * 24 + hours, mins, secs, msecs);        <span class="comment">// measure the difference in milliseconds between two calls to now()</span>    datetime m = now();    psleep(16);  <span class="comment">// sleep 16 milliseconds</span>    pout.putf("A 16 millisecond dream lasted actually %d milliseconds\n", now() - m);    <span class="comment">// this will show the actual precision of the clock on the given platform;    // Windows, f.ex., always shows the difference in 10 msec increments</span>}</pre></blockquote><!-- #EndEditable --><hr size="1"><a href="../index.html" class="ns">PTypes home</a></body><!-- #EndTemplate --></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -