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

📄 ptime_8h-source.html

📁 pwlib开发文档
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>ptime.h Source File</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.2.18 --><center><a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; </center><hr><h1>ptime.h</h1><a href="ptime_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/*</span>00002 <span class="comment"> * ptime.h</span>00003 <span class="comment"> *</span>00004 <span class="comment"> * Time and date class.</span>00005 <span class="comment"> *</span>00006 <span class="comment"> * Portable Windows Library</span>00007 <span class="comment"> *</span>00008 <span class="comment"> * Copyright (c) 1993-1998 Equivalence Pty. Ltd.</span>00009 <span class="comment"> *</span>00010 <span class="comment"> * The contents of this file are subject to the Mozilla Public License</span>00011 <span class="comment"> * Version 1.0 (the "License"); you may not use this file except in</span>00012 <span class="comment"> * compliance with the License. You may obtain a copy of the License at</span>00013 <span class="comment"> * http://www.mozilla.org/MPL/</span>00014 <span class="comment"> *</span>00015 <span class="comment"> * Software distributed under the License is distributed on an "AS IS"</span>00016 <span class="comment"> * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See</span>00017 <span class="comment"> * the License for the specific language governing rights and limitations</span>00018 <span class="comment"> * under the License.</span>00019 <span class="comment"> *</span>00020 <span class="comment"> * The Original Code is Portable Windows Library.</span>00021 <span class="comment"> *</span>00022 <span class="comment"> * The Initial Developer of the Original Code is Equivalence Pty. Ltd.</span>00023 <span class="comment"> *</span>00024 <span class="comment"> * Portions are Copyright (C) 1993 Free Software Foundation, Inc.</span>00025 <span class="comment"> * All Rights Reserved.</span>00026 <span class="comment"> *</span>00027 <span class="comment"> * Contributor(s): ______________________________________.</span>00028 <span class="comment"> *</span>00029 <span class="comment"> * $Log: ptime.h,v $</span>00030 <span class="comment"> * Revision 1.34  2003/09/17 05:41:59  csoutheren</span>00031 <span class="comment"> * Removed recursive includes</span>00032 <span class="comment"> *</span>00033 <span class="comment"> * Revision 1.33  2003/09/17 01:18:02  csoutheren</span>00034 <span class="comment"> * Removed recursive include file system and removed all references</span>00035 <span class="comment"> * to deprecated coooperative threading support</span>00036 <span class="comment"> *</span>00037 <span class="comment"> * Revision 1.32  2002/12/10 04:45:14  robertj</span>00038 <span class="comment"> * Added support in PTime for ISO 8601 format.</span>00039 <span class="comment"> *</span>00040 <span class="comment"> * Revision 1.31  2002/10/29 00:07:03  robertj</span>00041 <span class="comment"> * Added IsValid() function to indicate that a PTime is set correctly.</span>00042 <span class="comment"> *</span>00043 <span class="comment"> * Revision 1.30  2002/09/16 01:08:59  robertj</span>00044 <span class="comment"> * Added #define so can select if #pragma interface/implementation is used on</span>00045 <span class="comment"> *   platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.</span>00046 <span class="comment"> *</span>00047 <span class="comment"> * Revision 1.29  2001/05/22 12:49:32  robertj</span>00048 <span class="comment"> * Did some seriously wierd rewrite of platform headers to eliminate the</span>00049 <span class="comment"> *   stupid GNU compiler warning about braces not matching.</span>00050 <span class="comment"> *</span>00051 <span class="comment"> * Revision 1.28  2000/04/29 08:14:52  robertj</span>00052 <span class="comment"> * Added some documentation on string formats that can be parsed into a time.</span>00053 <span class="comment"> *</span>00054 <span class="comment"> * Revision 1.27  2000/04/29 04:49:00  robertj</span>00055 <span class="comment"> * Added microseconds to string output.</span>00056 <span class="comment"> *</span>00057 <span class="comment"> * Revision 1.26  2000/04/05 02:50:16  robertj</span>00058 <span class="comment"> * Added microseconds to PTime class.</span>00059 <span class="comment"> *</span>00060 <span class="comment"> * Revision 1.25  1999/03/09 02:59:50  robertj</span>00061 <span class="comment"> * Changed comments to doc++ compatible documentation.</span>00062 <span class="comment"> *</span>00063 <span class="comment"> * Revision 1.24  1999/02/16 08:11:10  robertj</span>00064 <span class="comment"> * MSVC 6.0 compatibility changes.</span>00065 <span class="comment"> *</span>00066 <span class="comment"> * Revision 1.23  1998/09/23 06:21:15  robertj</span>00067 <span class="comment"> * Added open source copyright license.</span>00068 <span class="comment"> *</span>00069 <span class="comment"> * Revision 1.22  1998/01/04 08:04:27  robertj</span>00070 <span class="comment"> * Changed gmtime and locatime to use operating system specific functions.</span>00071 <span class="comment"> *</span>00072 <span class="comment"> * Revision 1.21  1997/01/12 04:21:40  robertj</span>00073 <span class="comment"> * Added IsPast() and IsFuture() functions for time comparison.</span>00074 <span class="comment"> *</span>00075 <span class="comment"> * Revision 1.20  1996/05/09 12:16:06  robertj</span>00076 <span class="comment"> * Fixed syntax error found by Mac platform.</span>00077 <span class="comment"> *</span>00078 <span class="comment"> * Revision 1.19  1996/02/15 14:47:34  robertj</span>00079 <span class="comment"> * Fixed bugs in time zone compensation (some in the C library).</span>00080 <span class="comment"> *</span>00081 <span class="comment"> * Revision 1.18  1996/02/13 12:58:43  robertj</span>00082 <span class="comment"> * Changed GetTimeZone() so can specify standard/daylight time.</span>00083 <span class="comment"> *</span>00084 <span class="comment"> * Revision 1.17  1996/02/08 12:13:03  robertj</span>00085 <span class="comment"> * Changed zone parameter in PTime to indicate the time zone as minutes not enum.</span>00086 <span class="comment"> * Staticised some functions that are system global.</span>00087 <span class="comment"> *</span>00088 <span class="comment"> * Revision 1.16  1996/02/03 11:04:52  robertj</span>00089 <span class="comment"> * Added string constructor for times, parses date/time from string.</span>00090 <span class="comment"> *</span>00091 <span class="comment"> * Revision 1.15  1996/01/03 11:09:34  robertj</span>00092 <span class="comment"> * Added Universal Time and Time Zones to PTime class.</span>00093 <span class="comment"> *</span>00094 <span class="comment"> * Revision 1.14  1995/06/17 11:13:10  robertj</span>00095 <span class="comment"> * Documentation update.</span>00096 <span class="comment"> *</span>00097 <span class="comment"> * Revision 1.13  1995/03/14 12:42:18  robertj</span>00098 <span class="comment"> * Updated documentation to use HTML codes.</span>00099 <span class="comment"> *</span>00100 <span class="comment"> * Revision 1.12  1995/01/11  09:45:12  robertj</span>00101 <span class="comment"> * Documentation and normalisation.</span>00102 <span class="comment"> *</span>00103 <span class="comment"> * Revision 1.11  1995/01/09  12:34:05  robertj</span>00104 <span class="comment"> * Removed unnecesary return value from I/O functions.</span>00105 <span class="comment"> *</span>00106 <span class="comment"> * Revision 1.10  1994/08/23  11:32:52  robertj</span>00107 <span class="comment"> * Oops</span>00108 <span class="comment"> *</span>00109 <span class="comment"> * Revision 1.9  1994/08/22  00:46:48  robertj</span>00110 <span class="comment"> * Added pragma fro GNU C++ compiler.</span>00111 <span class="comment"> *</span>00112 <span class="comment"> * Revision 1.8  1994/07/27  05:58:07  robertj</span>00113 <span class="comment"> * Synchronisation.</span>00114 <span class="comment"> *</span>00115 <span class="comment"> * Revision 1.7  1994/06/25  11:55:15  robertj</span>00116 <span class="comment"> * Unix version synchronisation.</span>00117 <span class="comment"> *</span>00118 <span class="comment"> * Revision 1.6  1994/01/13  03:16:09  robertj</span>00119 <span class="comment"> * Added function to return time as a string.</span>00120 <span class="comment"> *</span>00121 <span class="comment"> * Revision 1.5  1994/01/03  04:42:23  robertj</span>00122 <span class="comment"> * Mass changes to common container classes and interactors etc etc etc.</span>00123 <span class="comment"> *</span>00124 <span class="comment"> * Revision 1.4  1993/12/31  06:45:38  robertj</span>00125 <span class="comment"> * Made inlines optional for debugging purposes.</span>00126 <span class="comment"> *</span>00127 <span class="comment"> * Revision 1.3  1993/08/27  18:17:47  robertj</span>00128 <span class="comment"> * Made time functions common to all platforms.</span>00129 <span class="comment"> * Moved timer resolution function to PTimeInterval wher it belongs.</span>00130 <span class="comment"> *</span>00131 <span class="comment"> * Revision 1.2  1993/07/14  12:49:16  robertj</span>00132 <span class="comment"> * Fixed RCS keywords.</span>00133 <span class="comment"> *</span>00134 <span class="comment"> */</span>00135 00136 <span class="preprocessor">#ifndef _PTIME</span>00137 <span class="preprocessor"></span><span class="preprocessor">#define _PTIME</span>00138 <span class="preprocessor"></span>00139 <span class="preprocessor">#ifdef P_USE_PRAGMA</span>00140 <span class="preprocessor"></span><span class="preprocessor">#pragma interface</span>00141 <span class="preprocessor"></span><span class="preprocessor">#endif</span>00142 <span class="preprocessor"></span>00143 00144 <span class="preprocessor">#include &lt;time.h&gt;</span>00145 00146 00148 <span class="comment">// System time and date class</span>00149 00150 <span class="keyword">class </span><a class="code" href="classPTimeInterval.html">PTimeInterval</a>;00151 00152 <a name="l00158"></a><a class="code" href="classPTime.html">00158</a> <span class="keyword">class </span><a class="code" href="classPTime.html">PTime</a> : <span class="keyword">public</span> <a class="code" href="classPObject.html">PObject</a>00159 {00160   <a class="code" href="object_8h.html#a27">PCLASSINFO</a>(<a class="code" href="classPTime.html">PTime</a>, <a class="code" href="classPObject.html">PObject</a>);00161 00162   <span class="keyword">public</span>:00168     <span class="keyword">enum</span> {00170       <a class="code" href="classPTime.html#z293_0s0">UTC</a>   = 0,00172       <a class="code" href="classPTime.html#z293_0s1">GMT</a>   = <a class="code" href="classPTime.html#z293_0s0">UTC</a>,00174       <a class="code" href="classPTime.html#z293_0s2">Local</a> = 999900175     };00176 00180     <a class="code" href="classPTime.html#z293_1">PTime</a>();00181 <a name="l00185"></a><a class="code" href="classPTime.html#z293_2">00185</a>     <a class="code" href="classPTime.html#z293_1">PTime</a>(00186       time_t tsecs,          00187       <span class="keywordtype">long</span> usecs = 000188     ) { <a class="code" href="classPTime.html#n0">theTime</a> = tsecs; <a class="code" href="classPTime.html#n1">microseconds</a> = usecs; }00189 00206     <a class="code" href="classPTime.html#z293_1">PTime</a>(00207       <span class="keyword">const</span> <a class="code" href="classPString.html">PString</a> &amp; str   00208     );00209 00213     <a class="code" href="classPTime.html#z293_1">PTime</a>(00214       <span class="keywordtype">int</span> second,           00215       <span class="keywordtype">int</span> minute,           00216       <span class="keywordtype">int</span> hour,             00217       <span class="keywordtype">int</span> day,              00218       <span class="keywordtype">int</span> month,            00219       <span class="keywordtype">int</span> year,             00220       <span class="keywordtype">int</span> tz = <a class="code" href="classPTime.html#z293_0s2">Local</a>        00221     );00223 00232     <a class="code" href="classPObject.html">PObject</a> * <a class="code" href="classPTime.html#z295_0">Clone</a>() <span class="keyword">const</span>;00233 00240     <span class="keyword">virtual</span> <a class="code" href="classPObject.html#z199_0">Comparison</a> <a class="code" href="classPTime.html#z295_1">Compare</a>(00241       <span class="keyword">const</span> <a class="code" href="classPObject.html">PObject</a> &amp; obj   00242     ) <span class="keyword">const</span>;00243 00247     <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPTime.html#z295_2">PrintOn</a>(00248       ostream &amp; strm    00249     ) <span class="keyword">const</span>;00250 00267     <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPTime.html#z295_3">ReadFrom</a>(00268       istream &amp; strm    00269     );00271 00280     BOOL <a class="code" href="classPTime.html#z297_2">IsValid</a>() <span class="keyword">const</span>;00281 00288     PInt64 <a class="code" href="classPTime.html#z297_3">GetTimestamp</a>() <span class="keyword">const</span>;00289 00296     time_t <a class="code" href="classPTime.html#z297_4">GetTimeInSeconds</a>() <span class="keyword">const</span>;00297 00303     <span class="keywordtype">long</span> <a class="code" href="classPTime.html#z297_5">GetMicrosecond</a>() <span class="keyword">const</span>;

⌨️ 快捷键说明

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