00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef TIME_HH
00025 #define TIME_HH
00026
00027 #ifdef WIN32
00028 #include <windows.h>
00029 #include <sys/timeb.h>
00030 #else
00031 #include <sys/time.h>
00032 #endif
00033
00034 #include <ctime>
00035 #include <iostream>
00036
00037 #include "inline-macro.hh"
00038 #include "tools-win32.hh"
00039
00045 class DLL_TOOLS CTime
00046 {
00047 public:
00048
00053
00062 CTime();
00063
00064 #ifdef WIN32
00065
00076 CTime(long ASec, long AMilliSec = 0);
00077
00078 #else // WIN32
00079
00090 CTime(long ASec, long AMicroSec = 0);
00091
00092 #endif // WIN32
00093
00095
00100
00101 #ifdef WIN32
00102
00112 void setTime(long ASec, long AMilliSec = 0);
00113
00123 void getTime(long * ASec, long * AMilliSec) const;
00124
00125 #else // WIN32
00126
00136 void setTime(long ASec, long AMicroSec = 0);
00137
00147 void getTime(long * ASec, long * AMicroSec) const;
00148
00149 #endif // WIN32
00150
00156 void updateTime();
00157
00165 void displayTime(std::ostream & AStream, bool ADisplayAll = true) const;
00166
00175 CTime operator + (const CTime & ATime) const;
00176
00185 CTime operator - (const CTime & ATime) const;
00186
00195 const CTime & operator += (const CTime & ATime);
00196
00205 const CTime & operator -= (const CTime & ATime);
00206
00208
00209 private:
00210
00215
00220 #ifdef WIN32
00221 struct _timeb FTime;
00222 #else
00223 struct timeval FTime;
00224 #endif
00225
00227 };
00228
00229 DLL_TOOLS std::ostream & operator << (std::ostream & AStream,
00230 const CTime & ATime);
00231
00232 #include INCLUDE_INLINE("time.icc")
00233
00234 #endif