/usr/include/ptlib/timeint.h is in libpt-1.10.10-dev 1.10.10-3.1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 | /*
* timeint.h
*
* Millisecond resolution time interval class (uses 64 bit integers).
*
* Portable Windows Library
*
* Copyright (c) 1993-1998 Equivalence Pty. Ltd.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Portable Windows Library.
*
* The Initial Developer of the Original Code is Equivalence Pty. Ltd.
*
* Portions are Copyright (C) 1993 Free Software Foundation, Inc.
* All Rights Reserved.
*
* Contributor(s): ______________________________________.
*
* $Log: timeint.h,v $
* Revision 1.31 2005/11/25 03:43:47 csoutheren
* Fixed function argument comments to be compatible with Doxygen
*
* Revision 1.30 2004/04/18 04:33:36 rjongbloed
* Changed all operators that return BOOL to return standard type bool. This is primarily
* for improved compatibility with std STL usage removing many warnings.
*
* Revision 1.29 2003/09/17 05:41:59 csoutheren
* Removed recursive includes
*
* Revision 1.28 2003/09/17 01:18:02 csoutheren
* Removed recursive include file system and removed all references
* to deprecated coooperative threading support
*
* Revision 1.27 2002/09/16 01:08:59 robertj
* Added #define so can select if #pragma interface/implementation is used on
* platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
*
* Revision 1.26 2002/05/28 13:05:26 robertj
* Fixed PTimer::SetInterval so it restarts timer as per operator=()
*
* Revision 1.25 2001/10/16 07:44:06 robertj
* Added AsString() function to PTimeInterval.
*
* Revision 1.24 2001/07/10 02:55:16 robertj
* Added unary minus operator
*
* Revision 1.23 2001/05/22 12:49:32 robertj
* Did some seriously wierd rewrite of platform headers to eliminate the
* stupid GNU compiler warning about braces not matching.
*
* Revision 1.22 2000/10/05 23:36:26 robertj
* Fixed compiler ambiguities in PTimeInterval constructor.
*
* Revision 1.21 2000/03/06 04:09:23 robertj
* Added constructor to do PString conversion to PTimeInterval
*
* Revision 1.20 1999/07/06 04:46:00 robertj
* Fixed being able to case an unsigned to a PTimeInterval.
* Improved resolution of PTimer::Tick() to be millisecond accurate.
*
* Revision 1.19 1999/03/09 02:59:51 robertj
* Changed comments to doc++ compatible documentation.
*
* Revision 1.18 1999/02/16 08:11:17 robertj
* MSVC 6.0 compatibility changes.
*
* Revision 1.17 1998/09/23 06:21:43 robertj
* Added open source copyright license.
*
* Revision 1.16 1998/01/26 00:49:53 robertj
* Added multiply and divide operators to PTimeInterval.
*
* Revision 1.15 1996/05/15 10:19:29 robertj
* Changed millisecond access functions to get 64 bit integer.
*
* Revision 1.14 1996/05/09 12:22:09 robertj
* Resolved C++ problems with 64 bit PTimeInterval for Mac platform.
*
* Revision 1.13 1996/03/17 05:52:02 robertj
* Changed PTimeInterval to 64 bit integer.
*
* Revision 1.12 1995/03/14 12:42:50 robertj
* Updated documentation to use HTML codes.
*
* Revision 1.11 1995/01/18 09:01:32 robertj
* Documentation.
*
* Revision 1.10 1995/01/09 12:29:41 robertj
* Removed unnecesary return value from I/O functions.
*
* Revision 1.9 1994/08/23 11:32:52 robertj
* Oops
*
* Revision 1.8 1994/08/22 00:46:48 robertj
* Added pragma fro GNU C++ compiler.
*
* Revision 1.7 1994/07/02 03:03:49 robertj
* Timer redesign consequences and ability to compare a time interval against
* ordinary integer milliseconds.
*
* Revision 1.6 1994/06/25 11:55:15 robertj
* Unix version synchronisation.
*
* Revision 1.5 1994/01/03 04:42:23 robertj
* Mass changes to common container classes and interactors etc etc etc.
*
* Revision 1.4 1993/08/31 03:38:02 robertj
* Added copy constructor and assignement oeprator due to G++ strangeness.
*
* Revision 1.3 1993/08/27 18:17:47 robertj
* Added function to set the interval of a PTieInterval object.
* Used a common type for number of milliseconds.
*
* Revision 1.2 1993/07/14 12:49:16 robertj
* Fixed RCS keywords.
*
*/
#ifndef _PTIMEINTERVAL
#define _PTIMEINTERVAL
#ifdef P_USE_PRAGMA
#pragma interface
#endif
///////////////////////////////////////////////////////////////////////////////
// Difference between two system times
/** This class defines an arbitrary time interval to millisecond accuracy. The
interval can be both positive and negative.
A long int is used to store the time interval so it is limited to LONG_MAX
(found in the standard C header file limits.h) milliseconds. This is
approximately 596 hours for 32 bit integers.
There is a constant, #PMaxTimeInterval# which defines the
maximum number of milliseconds that a time interval may be.
*/
class PTimeInterval : public PObject
{
PCLASSINFO(PTimeInterval, PObject);
public:
/**@name Construction */
//@{
/** Create a new time interval object. The time interval, in milliseconds,
is the sum of all of the parameters. For example all of the following
are equivalent:
\begin{verbatim}
PTimeInterval(120000)
PTimeInterval(60000, 60)
PTimeInterval(60000, 0, 1)
PTimeInterval(0, 60, 1)
PTimeInterval(0, 0, 2)
\end{verbatim}
*/
PTimeInterval(
PInt64 millisecs = 0 ///< Number of milliseconds for interval.
);
PTimeInterval(
long millisecs, ///< Number of milliseconds for interval.
long seconds, ///< Number of seconds for interval.
long minutes = 0, ///< Number of minutes for interval.
long hours = 0, ///< Number of hours for interval.
int days = 0 ///< Number of days for interval.
);
PTimeInterval(
const PString & str ///< String representation of time interval.
);
//@}
/**@name Overrides from class PObject */
//@{
/** Create a new copy of the time interval. It is the responsibility of the
called to delete the object.
@return
new time interval on heap.
*/
PObject * Clone() const;
/** Rank the two time intervals. This ranks the intervals as you would
expect for two integers.
@return
#EqualTo#, #LessThan# or #GreaterThan#
depending on their relative rank.
*/
virtual Comparison Compare(
const PObject & obj ///< Time interval to compare against.
) const;
/** Output the time interval to the I/O stream. This outputs the number of
milliseconds as a signed decimal integer number.
*/
virtual void PrintOn(
ostream & strm ///< I/O stream to output the time interval.
) const;
/** Input the time interval from the I/O stream. This expects the input
to be a signed decimal integer number.
*/
virtual void ReadFrom(
istream & strm ///< I/O stream to input the time interval from.
);
//@}
/**@name Conversion functions */
//@{
enum Formats {
NormalFormat,
IncludeDays,
SecondsOnly
};
PString AsString(
int decimals = 3,
Formats format = NormalFormat,
int width = 1
) const;
//@}
/**@name Access functions */
//@{
/** Get the number of milliseconds for the time interval.
@return
very long integer number of milliseconds.
*/
PInt64 GetMilliSeconds() const;
/** Get the number of whole seconds for the time interval.
@return
long integer number of seconds.
*/
long GetSeconds() const;
/** Get the number of whole minutes for the time interval.
@return
integer number of minutes.
*/
long GetMinutes() const;
/** Get the number of whole hours for the time interval.
@return
integer number of hours.
*/
int GetHours() const;
/** Get the number of whole days for the time interval.
@return
integer number of days.
*/
int GetDays() const;
/** Get the number of milliseconds for the time interval.
@return
long integer number of milliseconds.
*/
DWORD GetInterval() const;
/** Set the value of the time interval. The time interval, in milliseconds,
is the sum of all of the parameters. For example all of the following
are equivalent:
\begin{verbatim}
SetInterval(120000)
SetInterval(60000, 60)
SetInterval(60000, 0, 1)
SetInterval(0, 60, 1)
SetInterval(0, 0, 2)
\end{verbatim}
*/
virtual void SetInterval(
PInt64 milliseconds = 0, ///< Number of milliseconds for interval.
long seconds = 0, ///< Number of seconds for interval.
long minutes = 0, ///< Number of minutes for interval.
long hours = 0, ///< Number of hours for interval.
int days = 0 ///< Number of days for interval.
);
//@}
/**@name Operations */
//@{
/** Unary minus, get negative of time interval.
@return
difference of the time intervals.
*/
PTimeInterval operator-() const;
/** Add the two time intervals yielding a third time interval.
@return
sum of the time intervals.
*/
PTimeInterval operator+(
const PTimeInterval & interval ///< Time interval to add.
) const;
/** Add the second time interval to the first time interval.
@return
reference to first time interval.
*/
PTimeInterval & operator+=(
const PTimeInterval & interval ///< Time interval to add.
);
/** Subtract the two time intervals yielding a third time interval.
@return
difference of the time intervals.
*/
PTimeInterval operator-(
const PTimeInterval & interval ///< Time interval to subtract.
) const;
/** Subtract the second time interval from the first time interval.
@return
reference to first time interval.
*/
PTimeInterval & operator-=(
const PTimeInterval & interval ///< Time interval to subtract.
);
/** Multiply the time interval by a factor yielding a third time interval.
@return
the time intervals times the factor.
*/
PTimeInterval operator*(
int factor ///< factor to multiply.
) const;
/** Multiply the time interval by a factor.
@return
reference to time interval.
*/
PTimeInterval & operator*=(
int factor ///< factor to multiply.
);
/** Divide the time interval by a factor yielding a third time interval.
@return
the time intervals divided by the factor.
*/
PTimeInterval operator/(
int factor ///< factor to divide.
) const;
/** Divide the time interval by a factor.
@return
reference to time interval.
*/
PTimeInterval & operator/=(
int factor ///< factor to divide.
);
//@}
/**@name Comparison functions */
//@{
/** Compare to the two time intervals. This is provided as an override to
the default in PObject so that comparisons can be made to integer
literals that represent milliseconds.
@return
TRUE if intervals are equal.
*/
bool operator==(
const PTimeInterval & interval ///< Time interval to compare.
) const;
bool operator==(
long msecs ///< Time interval as integer milliseconds to compare.
) const;
/** Compare to the two time intervals. This is provided as an override to
the default in PObject so that comparisons can be made to integer
literals that represent milliseconds.
@return
TRUE if intervals are not equal.
*/
bool operator!=(
const PTimeInterval & interval ///< Time interval to compare.
) const;
bool operator!=(
long msecs ///< Time interval as integer milliseconds to compare.
) const;
/** Compare to the two time intervals. This is provided as an override to
the default in PObject so that comparisons can be made to integer
literals that represent milliseconds.
@return
TRUE if intervals are greater than.
*/
bool operator> (
const PTimeInterval & interval ///< Time interval to compare.
) const;
bool operator> (
long msecs ///< Time interval as integer milliseconds to compare.
) const;
/** Compare to the two time intervals. This is provided as an override to
the default in PObject so that comparisons can be made to integer
literals that represent milliseconds.
@return
TRUE if intervals are greater than or equal.
*/
bool operator>=(
const PTimeInterval & interval ///< Time interval to compare.
) const;
bool operator>=(
long msecs ///< Time interval as integer milliseconds to compare.
) const;
/** Compare to the two time intervals. This is provided as an override to
the default in PObject so that comparisons can be made to integer
literals that represent milliseconds.
@return
TRUE if intervals are less than.
*/
bool operator< (
const PTimeInterval & interval ///< Time interval to compare.
) const;
bool operator< (
long msecs ///< Time interval as integer milliseconds to compare.
) const;
/** Compare to the two time intervals. This is provided as an override to
the default in PObject so that comparisons can be made to integer
literals that represent milliseconds.
@return
TRUE if intervals are less than or equal.
*/
bool operator<=(
const PTimeInterval & interval ///< Time interval to compare.
) const;
bool operator<=(
long msecs ///< Time interval as integer milliseconds to compare.
) const;
//@}
protected:
// Member variables
/// Number of milliseconds in time interval.
PInt64 milliseconds;
// Include platform dependent part of class
#ifdef _WIN32
#include "msos/ptlib/timeint.h"
#else
#include "unix/ptlib/timeint.h"
#endif
};
#endif
// End Of File ///////////////////////////////////////////////////////////////
|