ptypes

ptypes Mercurial Source Tree


Root/doc/include/ptime.h.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<!--
Syntax highlighting generated by Web C Plus Plus software v0.8.4
Webcpp Copyright (C)2001-2004 Jeffrey Bakker under the GNU GPL
Get webcpp at http://webcpp.sf.net
-->

<html>
<head>
<title>ptime.h</title>
<style type="text/css">

/*
Webcpp v0.8.1 compatible StyleSheet
http://webcpp.sf.net
Theme: ide-msvcpp
*/

body
{
background-color: #ffffff
}

.webcpp a:link    {color:#000000}
.webcpp a:visited {color:#008000}
.webcpp a:active  {color:#0000ff}
.webcpp a:hover   {color:#0000ff}

.webcpp pre
{
color: #000000
}

.webcpp font
{
font-size:100%
}

.webcpp .symbols
{
color: #000000
}

.webcpp .preproc
{
color: #0000ff
}

.webcpp .integer
{
color: #000000
}

.webcpp .floatpt
{
color: #000000
}

.webcpp .dblquot
{
color: #000000
}

.webcpp .sinquot
{
color: #000000
}

.webcpp .keyword
{
color: #0000ff;

}

.webcpp .keytype
{
color: #0000ff;

}

.webcpp .comment
{
color: #008000;

}

</style>
</head>
<body bgcolor="#FFFFFF" leftmargin="40" marginwidth="40"> <p><a href="../htsrc.html">Index</a><hr noshade></p>

<div class="webcpp">
<pre>


<font CLASS=preproc>#ifndef</font> __PTIME_H__ 
<font CLASS=preproc>#define</font> __PTIME_H__ 

<font CLASS=preproc>#ifndef</font> __PPORT_H__ 
<font CLASS=preproc>#include</font> <font CLASS=dblquot>"pport.h"</font> 
<font CLASS=preproc>#endif</font> 

<font CLASS=preproc>#ifndef</font> __PTYPES_H__ 
<font CLASS=preproc>#include</font> <font CLASS=dblquot>"ptypes.h"</font> 
<font CLASS=preproc>#endif</font> 


<font CLASS=preproc>#include</font> <time.h> 


PTYPES_BEGIN

<font CLASS=comment>// datetime type: 64-bit, number of milliseconds since midnight 01/01/0001</font>
<font CLASS=keyword>typedef</font> large datetime;

<font CLASS=preproc>#define</font> invdatetime LLCONST(<font CLASS=symbols>-</font><font CLASS=integer>1</font>) 

<font CLASS=preproc>#define</font> _msecsmax <font CLASS=integer>86400000</font>                    <font CLASS=comment>// number of milliseconds in one day </font>
<font CLASS=preproc>#define</font> _daysmax  <font CLASS=integer>3652059</font>                     <font CLASS=comment>// number of days between 01/01/0001 and 12/31/9999 </font>
<font CLASS=preproc>#define</font> _datetimemax LLCONST(<font CLASS=integer>315537897600000</font>) <font CLASS=comment>// max. allowed number for datetime type </font>
<font CLASS=preproc>#define</font> _unixepoch LLCONST(<font CLASS=integer>62135596800000</font>)    <font CLASS=comment>// difference between time_t and datetime in milliseconds </font>


<font CLASS=comment>// datetime general utilities</font>
<font CLASS=keyword>inline</font> <font CLASS=keytype>int</font> days(datetime d)            { <font CLASS=keyword>return</font> <font CLASS=keytype>int</font>(d / _msecsmax); }
<font CLASS=keyword>inline</font> <font CLASS=keytype>int</font> msecs(datetime d)           { <font CLASS=keyword>return</font> <font CLASS=keytype>int</font>(d % _msecsmax); }

datetime mkdt(<font CLASS=keytype>int</font> days, <font CLASS=keytype>int</font> msecs);
<font CLASS=keytype>bool</font>     isvalid(datetime);
datetime now(<font CLASS=keytype>bool</font> utc <font CLASS=symbols>=</font> <font CLASS=keyword>true</font>);
<font CLASS=keytype>void</font>     tzupdate();
<font CLASS=keytype>int</font>      tzoffset();
string   dttostring(datetime, <font CLASS=keyword>const</font> <font CLASS=keytype>char</font>* fmt);
string   nowstring(<font CLASS=keyword>const</font> <font CLASS=keytype>char</font>* fmt, <font CLASS=keytype>bool</font> utc <font CLASS=symbols>=</font> <font CLASS=keyword>true</font>);
datetime utodatetime(time_t u);
<font CLASS=keyword>struct</font> tm* dttotm(datetime dt, <font CLASS=keyword>struct</font> tm& t);

<font CLASS=comment>// date/calendar manipulation</font>
<font CLASS=keytype>bool</font>     isleapyear(<font CLASS=keytype>int</font> year);
<font CLASS=keytype>int</font>      daysinmonth(<font CLASS=keytype>int</font> year, <font CLASS=keytype>int</font> month);
<font CLASS=keytype>int</font>      daysinyear(<font CLASS=keytype>int</font> year, <font CLASS=keytype>int</font> month);
<font CLASS=keytype>int</font>      dayofweek(datetime);
<font CLASS=keytype>bool</font>     isdatevalid(<font CLASS=keytype>int</font> year, <font CLASS=keytype>int</font> month, <font CLASS=keytype>int</font> day);
datetime encodedate(<font CLASS=keytype>int</font> year, <font CLASS=keytype>int</font> month, <font CLASS=keytype>int</font> day);
<font CLASS=keytype>bool</font>     decodedate(datetime, <font CLASS=keytype>int</font>& year, <font CLASS=keytype>int</font>& month, <font CLASS=keytype>int</font>& day);

<font CLASS=comment>// time manipulation</font>
<font CLASS=keytype>bool</font>     istimevalid(<font CLASS=keytype>int</font> hour, <font CLASS=keytype>int</font> min, <font CLASS=keytype>int</font> sec, <font CLASS=keytype>int</font> msec <font CLASS=symbols>=</font> <font CLASS=integer>0</font>);
datetime encodetime(<font CLASS=keytype>int</font> hour, <font CLASS=keytype>int</font> min, <font CLASS=keytype>int</font> sec, <font CLASS=keytype>int</font> msec <font CLASS=symbols>=</font> <font CLASS=integer>0</font>);
<font CLASS=keytype>bool</font>     decodetime(datetime, <font CLASS=keytype>int</font>& hour, <font CLASS=keytype>int</font>& min, <font CLASS=keytype>int</font>& sec, <font CLASS=keytype>int</font>& msec);
<font CLASS=keytype>bool</font>     decodetime(datetime, <font CLASS=keytype>int</font>& hour, <font CLASS=keytype>int</font>& min, <font CLASS=keytype>int</font>& sec);


PTYPES_END

<font CLASS=preproc>#endif</font> <font CLASS=comment>// __PTIME_H__ </font>



</pre>

</div>


<hr noshade></body>
</html>
Source at commit 209d6fa3805c created 11 years 7 months ago.
By Nathan Adams, Updating tparray to use variants as array because tpodlist was causing variant data corruption

Archive Download this file

Branches

Tags

Page rendered in 0.75858s using 11 queries.