1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265
|
<HTML>
<HEAD>
<TITLE>class Time</TITLE>
<META NAME="Generator" CONTENT="KDOC ">
</HEAD>
<BODY bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#000099" alink= "#ffffff">
<TABLE WIDTH="100%" BORDER="0">
<TR>
<TD>
<TABLE BORDER="0">
<TR><TD valign="top" align="left" cellspacing="10">
<h1>class Time</h1>
</TD>
<TD valign="top" align="right" colspan="1">A time holding class. <small><A HREF="#longdesc">More...</A></small></TD></TR>
</TABLE>
<HR>
<TABLE BORDER="0">
<TR><TH>Full name</TH><TD><code><A HREF="TelEngine.html">TelEngine</A>::Time</code></TD></TR>
<TR><TH>Definition</TH><TD><code>#include <<A HREF="yateclass_h.html">yateclass.h</A>></code></TD></TR>
<TR><TH><A HREF="full-list-TelEngine__Time.html">List of all Methods</A></TH></TR>
</TABLE>
</TD>
<TD align="right"><TABLE BORDER="0"><TR><TD><small><A HREF="index-long.html">Annotated List</A></small></TD></TR>
<TR><TD><small><A HREF="header-list.html">Files</A></small></TD></TR>
<TR><TD><small><A HREF="all-globals.html">Globals</A></small></TD></TR>
<TR><TD><small><A HREF="hier.html">Hierarchy</A></small></TD></TR>
<TR><TD><small><A HREF="index.html">Index</A></small></TD></TR>
</TABLE></TD></TR></TABLE>
<h4>Public Methods</h4><ul><LI>inline <b><A HREF="#ref1">Time</A></b> ()
</LI>
<LI>inline <b><A HREF="#ref2">Time</A></b> (<A HREF="#u_int64_t">u_int64_t</A> usec)
</LI>
<LI>inline explicit <b><A HREF="#ref3">Time</A></b> (const struct timeval* tv)
</LI>
<LI>inline explicit <b><A HREF="#ref4">Time</A></b> (const struct timeval& tv)
</LI>
<LI>inline <b><A HREF="#ref5">~Time</A></b> ()
</LI>
<LI>inline <A HREF="#u_int32_t">u_int32_t</A> <b><A HREF="#ref6">sec</A></b> () const
</LI>
<LI>inline <A HREF="#u_int64_t">u_int64_t</A> <b><A HREF="#ref7">msec</A></b> () const
</LI>
<LI>inline <A HREF="#u_int64_t">u_int64_t</A> <b><A HREF="#ref8">usec</A></b> () const
</LI>
<LI>inline operator <b><A HREF="#ref9">u_int64_t</A></b> () const
</LI>
<LI>inline Time& <b><A HREF="#ref10">operator=</A></b> (<A HREF="#u_int64_t">u_int64_t</A> usec)
</LI>
<LI>inline Time& <b><A HREF="#ref11">operator+=</A></b> (<A HREF="#int64_t">int64_t</A> delta)
</LI>
<LI>inline Time& <b><A HREF="#ref12">operator-=</A></b> (<A HREF="#int64_t">int64_t</A> delta)
</LI>
<LI>inline void <b><A HREF="#ref13">toTimeval</A></b> (struct timeval* tv) const
</LI>
</ul><h4>Public Static Methods</h4><ul><LI>static void <b><A HREF="#ref14">toTimeval</A></b> (struct timeval* tv, <A HREF="#u_int64_t">u_int64_t</A> usec)
</LI>
<LI>static <A HREF="#u_int64_t">u_int64_t</A> <b><A HREF="#ref15">fromTimeval</A></b> (const struct timeval* tv)
</LI>
<LI>static inline <A HREF="#u_int64_t">u_int64_t</A> <b><A HREF="#ref16">fromTimeval</A></b> (const struct timeval& tv)
</LI>
<LI>static <A HREF="#u_int64_t">u_int64_t</A> <b><A HREF="#ref17">now</A></b> ()
</LI>
<LI>static <A HREF="#u_int64_t">u_int64_t</A> <b><A HREF="#ref18">msecNow</A></b> ()
</LI>
<LI>static <A HREF="#u_int32_t">u_int32_t</A> <b><A HREF="#ref19">secNow</A></b> ()
</LI>
<LI>static unsigned int <b><A HREF="#ref20">toEpoch</A></b> (int year, unsigned int month, unsigned int day,
unsigned int hour, unsigned int minute, unsigned int sec, int offset = 0)
</LI>
<LI>static bool <b><A HREF="#ref21">toDateTime</A></b> (unsigned int epochTimeSec, int& year, unsigned int& month,
unsigned int& day, unsigned int& hour, unsigned int& minute, unsigned int& sec)
</LI>
<LI>static inline bool <b><A HREF="#ref22">isLeap</A></b> (unsigned int year)
</LI>
</ul><HR><H2><A NAME="longdesc">Detailed Description</A></H2><p>
The Time class holds a time moment with microsecond accuracy
</p>
<A NAME="Time"></A><A NAME="ref1"></A><table width="100%"><tr bgcolor="#eeeeee"><td>inline <strong>Time</strong> ()
<br></td><td align="right"><h3><strong>Time</strong></h3></td></tr></table><p></p><p>
Constructs a Time object from the current time
</p>
<A NAME="Time"></A><A NAME="ref2"></A><table width="100%"><tr bgcolor="#eeeeee"><td>inline <strong>Time</strong> (<A HREF="#u_int64_t">u_int64_t</A> usec)
<br></td><td align="right"><h3><strong>Time</strong></h3></td></tr></table><p></p><p>
Constructs a Time object from a given time
</p>
<p><b>Parameters</b>:<TABLE BORDER="0" CELLPADDING="5">
<TR><TD align="left" valign="top"><i>usec</i></TD><TD align="left" valign="top">Time in microseconds
</TD></TR>
</TABLE></P>
<A NAME="Time"></A><A NAME="ref3"></A><table width="100%"><tr bgcolor="#eeeeee"><td>inline explicit <strong>Time</strong> (const struct timeval* tv)
<br></td><td align="right"><h3><strong>Time</strong></h3></td></tr></table><p></p><p>
Constructs a Time object from a timeval structure pointer
</p>
<p><b>Parameters</b>:<TABLE BORDER="0" CELLPADDING="5">
<TR><TD align="left" valign="top"><i>tv</i></TD><TD align="left" valign="top">Pointer to the timeval structure
</TD></TR>
</TABLE></P>
<A NAME="Time"></A><A NAME="ref4"></A><table width="100%"><tr bgcolor="#eeeeee"><td>inline explicit <strong>Time</strong> (const struct timeval& tv)
<br></td><td align="right"><h3><strong>Time</strong></h3></td></tr></table><p></p><p>
Constructs a Time object from a timeval structure
</p>
<p><b>Parameters</b>:<TABLE BORDER="0" CELLPADDING="5">
<TR><TD align="left" valign="top"><i>tv</i></TD><TD align="left" valign="top">Reference of the timeval structure
</TD></TR>
</TABLE></P>
<A NAME="~Time"></A><A NAME="ref5"></A><table width="100%"><tr bgcolor="#eeeeee"><td>inline <strong>~Time</strong> ()
<br></td><td align="right"><h3><strong>~Time</strong></h3></td></tr></table><p></p><p>
Do-nothing destructor that keeps the compiler from complaining
about inlining derivates or members of Time type
</p>
<A NAME="sec"></A><A NAME="ref6"></A><table width="100%"><tr bgcolor="#eeeeee"><td>inline <A HREF="#u_int32_t">u_int32_t</A> <strong>sec</strong> ()
<br></td><td align="right"><h3><strong>sec</strong></h3></td></tr></table><p> <small>[const]</small></p><p>
Get time in seconds
</p>
<p><b>Returns</b>: Time in seconds since the Epoch
</p>
<A NAME="msec"></A><A NAME="ref7"></A><table width="100%"><tr bgcolor="#eeeeee"><td>inline <A HREF="#u_int64_t">u_int64_t</A> <strong>msec</strong> ()
<br></td><td align="right"><h3><strong>msec</strong></h3></td></tr></table><p> <small>[const]</small></p><p>
Get time in milliseconds
</p>
<p><b>Returns</b>: Time in milliseconds since the Epoch
</p>
<A NAME="usec"></A><A NAME="ref8"></A><table width="100%"><tr bgcolor="#eeeeee"><td>inline <A HREF="#u_int64_t">u_int64_t</A> <strong>usec</strong> ()
<br></td><td align="right"><h3><strong>usec</strong></h3></td></tr></table><p> <small>[const]</small></p><p>
Get time in microseconds
</p>
<p><b>Returns</b>: Time in microseconds since the Epoch
</p>
<A NAME="u_int64_t"></A><A NAME="ref9"></A><table width="100%"><tr bgcolor="#eeeeee"><td>inline operator <strong>u_int64_t</strong> ()
<br></td><td align="right"><h3><strong>u_int64_t</strong></h3></td></tr></table><p> <small>[const]</small></p><p>
Conversion to microseconds operator
</p>
<A NAME="operator="></A><A NAME="ref10"></A><table width="100%"><tr bgcolor="#eeeeee"><td>inline Time& <strong>operator=</strong> (<A HREF="#u_int64_t">u_int64_t</A> usec)
<br></td><td align="right"><h3><strong>operator=</strong></h3></td></tr></table><p></p><p>
Assignment operator.
</p>
<A NAME="operator+="></A><A NAME="ref11"></A><table width="100%"><tr bgcolor="#eeeeee"><td>inline Time& <strong>operator+=</strong> (<A HREF="#int64_t">int64_t</A> delta)
<br></td><td align="right"><h3><strong>operator+=</strong></h3></td></tr></table><p></p><p>
Offsetting operator.
</p>
<A NAME="operator-="></A><A NAME="ref12"></A><table width="100%"><tr bgcolor="#eeeeee"><td>inline Time& <strong>operator-=</strong> (<A HREF="#int64_t">int64_t</A> delta)
<br></td><td align="right"><h3><strong>operator-=</strong></h3></td></tr></table><p></p><p>
Offsetting operator.
</p>
<A NAME="toTimeval"></A><A NAME="ref13"></A><table width="100%"><tr bgcolor="#eeeeee"><td>inline void <strong>toTimeval</strong> (struct timeval* tv)
<br></td><td align="right"><h3><strong>toTimeval</strong></h3></td></tr></table><p> <small>[const]</small></p><p>
Fill in a timeval struct from a value in microseconds
</p>
<p><b>Parameters</b>:<TABLE BORDER="0" CELLPADDING="5">
<TR><TD align="left" valign="top"><i>tv</i></TD><TD align="left" valign="top">Pointer to the timeval structure
</TD></TR>
</TABLE></P>
<A NAME="toTimeval"></A><A NAME="ref14"></A><table width="100%"><tr bgcolor="#eeeeee"><td> void <strong>toTimeval</strong> (struct timeval* tv, <A HREF="#u_int64_t">u_int64_t</A> usec)
<br></td><td align="right"><h3><strong>toTimeval</strong></h3></td></tr></table><p> <small>[static]</small></p><p>
Fill in a timeval struct from a value in microseconds
</p>
<p><b>Parameters</b>:<TABLE BORDER="0" CELLPADDING="5">
<TR><TD align="left" valign="top"><i>tv</i></TD><TD align="left" valign="top">Pointer to the timeval structure
</TD></TR>
<TR><TD align="left" valign="top"><i>usec</i></TD><TD align="left" valign="top">Time to convert to timeval
</TD></TR>
</TABLE></P>
<A NAME="fromTimeval"></A><A NAME="ref15"></A><table width="100%"><tr bgcolor="#eeeeee"><td> <A HREF="#u_int64_t">u_int64_t</A> <strong>fromTimeval</strong> (const struct timeval* tv)
<br></td><td align="right"><h3><strong>fromTimeval</strong></h3></td></tr></table><p> <small>[static]</small></p><p>
Convert time in a timeval struct to microseconds
</p>
<p><b>Parameters</b>:<TABLE BORDER="0" CELLPADDING="5">
<TR><TD align="left" valign="top"><i>tv</i></TD><TD align="left" valign="top">Pointer to the timeval structure
</TD></TR>
</TABLE></P>
<p><b>Returns</b>: Corresponding time in microseconds or zero if tv is NULL
</p>
<A NAME="fromTimeval"></A><A NAME="ref16"></A><table width="100%"><tr bgcolor="#eeeeee"><td>inline <A HREF="#u_int64_t">u_int64_t</A> <strong>fromTimeval</strong> (const struct timeval& tv)
<br></td><td align="right"><h3><strong>fromTimeval</strong></h3></td></tr></table><p> <small>[static]</small></p><p>
Convert time in a timeval struct to microseconds
</p>
<p><b>Parameters</b>:<TABLE BORDER="0" CELLPADDING="5">
<TR><TD align="left" valign="top"><i>tv</i></TD><TD align="left" valign="top">Reference of the timeval structure
</TD></TR>
</TABLE></P>
<p><b>Returns</b>: Corresponding time in microseconds
</p>
<A NAME="now"></A><A NAME="ref17"></A><table width="100%"><tr bgcolor="#eeeeee"><td> <A HREF="#u_int64_t">u_int64_t</A> <strong>now</strong> ()
<br></td><td align="right"><h3><strong>now</strong></h3></td></tr></table><p> <small>[static]</small></p><p>
Get the current system time in microseconds
</p>
<p><b>Returns</b>: Time in microseconds since the Epoch
</p>
<A NAME="msecNow"></A><A NAME="ref18"></A><table width="100%"><tr bgcolor="#eeeeee"><td> <A HREF="#u_int64_t">u_int64_t</A> <strong>msecNow</strong> ()
<br></td><td align="right"><h3><strong>msecNow</strong></h3></td></tr></table><p> <small>[static]</small></p><p>
Get the current system time in milliseconds
</p>
<p><b>Returns</b>: Time in milliseconds since the Epoch
</p>
<A NAME="secNow"></A><A NAME="ref19"></A><table width="100%"><tr bgcolor="#eeeeee"><td> <A HREF="#u_int32_t">u_int32_t</A> <strong>secNow</strong> ()
<br></td><td align="right"><h3><strong>secNow</strong></h3></td></tr></table><p> <small>[static]</small></p><p>
Get the current system time in seconds
</p>
<p><b>Returns</b>: Time in seconds since the Epoch
</p>
<A NAME="toEpoch"></A><A NAME="ref20"></A><table width="100%"><tr bgcolor="#eeeeee"><td> unsigned int <strong>toEpoch</strong> (int year, unsigned int month, unsigned int day,
unsigned int hour, unsigned int minute, unsigned int sec, int offset = 0)
<br></td><td align="right"><h3><strong>toEpoch</strong></h3></td></tr></table><p> <small>[static]</small></p><p>
Build EPOCH time from date/time components
</p>
<p><b>Parameters</b>:<TABLE BORDER="0" CELLPADDING="5">
<TR><TD align="left" valign="top"><i>year</i></TD><TD align="left" valign="top">The year component of the date. Must be greater then 1969
</TD></TR>
<TR><TD align="left" valign="top"><i>month</i></TD><TD align="left" valign="top">The month component of the date (1 to 12)
</TD></TR>
<TR><TD align="left" valign="top"><i>day</i></TD><TD align="left" valign="top">The day component of the date (1 to 31)
</TD></TR>
<TR><TD align="left" valign="top"><i>hour</i></TD><TD align="left" valign="top">The hour component of the time (0 to 23). The hour can be 24
if minute and sec are 0
</TD></TR>
<TR><TD align="left" valign="top"><i>minute</i></TD><TD align="left" valign="top">The minute component of the time (0 to 59)
</TD></TR>
<TR><TD align="left" valign="top"><i>sec</i></TD><TD align="left" valign="top">The seconds component of the time (0 to 59)
</TD></TR>
<TR><TD align="left" valign="top"><i>offset</i></TD><TD align="left" valign="top">Optional number of seconds to be added/substracted
to/from result. It can't exceed the number of seconds in a day
</TD></TR>
</TABLE></P>
<p><b>Returns</b>: EPOCH time in seconds, -1 on failure
</p>
<A NAME="toDateTime"></A><A NAME="ref21"></A><table width="100%"><tr bgcolor="#eeeeee"><td> bool <strong>toDateTime</strong> (unsigned int epochTimeSec, int& year, unsigned int& month,
unsigned int& day, unsigned int& hour, unsigned int& minute, unsigned int& sec)
<br></td><td align="right"><h3><strong>toDateTime</strong></h3></td></tr></table><p> <small>[static]</small></p><p>
Split a given EPOCH time into its date/time components
</p>
<p><b>Parameters</b>:<TABLE BORDER="0" CELLPADDING="5">
<TR><TD align="left" valign="top"><i>epochTimeSec</i></TD><TD align="left" valign="top">EPOCH time in seconds
</TD></TR>
<TR><TD align="left" valign="top"><i>year</i></TD><TD align="left" valign="top">The year component of the date
</TD></TR>
<TR><TD align="left" valign="top"><i>month</i></TD><TD align="left" valign="top">The month component of the date (1 to 12)
</TD></TR>
<TR><TD align="left" valign="top"><i>day</i></TD><TD align="left" valign="top">The day component of the date (1 to 31)
</TD></TR>
<TR><TD align="left" valign="top"><i>hour</i></TD><TD align="left" valign="top">The hour component of the time (0 to 23)
</TD></TR>
<TR><TD align="left" valign="top"><i>minute</i></TD><TD align="left" valign="top">The minute component of the time (0 to 59)
</TD></TR>
<TR><TD align="left" valign="top"><i>sec</i></TD><TD align="left" valign="top">The seconds component of the time (0 to 59)
</TD></TR>
</TABLE></P>
<p><b>Returns</b>: True on succes, false if conversion failed
</p>
<A NAME="isLeap"></A><A NAME="ref22"></A><table width="100%"><tr bgcolor="#eeeeee"><td> inline bool <strong>isLeap</strong> (unsigned int year)
<br></td><td align="right"><h3><strong>isLeap</strong></h3></td></tr></table><p> <small>[static]</small></p><p>
Check if an year is a leap one
</p>
<p><b>Parameters</b>:<TABLE BORDER="0" CELLPADDING="5">
<TR><TD align="left" valign="top"><i>year</i></TD><TD align="left" valign="top">The year to check
</TD></TR>
</TABLE></P>
<p><b>Returns</b>: True if the given year is a leap one
</p>
<HR>
<table>
<tr><td><small>Generated by: paulc on bussard on Mon Mar 8 12:18:15 2010, using kdoc 2.0a54.</small></td></tr>
</table>
</BODY>
</HTML>
|