Time.h

Go to the documentation of this file.
00001 #ifndef __TIME_H__
00002 #define __TIME_H__
00003 
00004 #include "../compat/inttypes.h"
00005 
00006 namespace oasys {
00007 
00011 struct Time {
00012     u_int32_t sec_;
00013     u_int32_t usec_;
00014 
00015     Time(u_int32_t sec  = 0,
00016          u_int32_t usec = 0) 
00017         : sec_(sec), usec_(usec) 
00018     {
00019         cleanup();
00020     }
00021     
00023     void get_time();
00024     
00026     double in_seconds();
00027 
00029     u_int32_t in_microseconds();
00030     
00032     u_int32_t in_milliseconds();
00033 
00035     // current time.
00036     u_int32_t elapsed_ms();
00037 
00039     Time operator+(const Time& t)  const;
00040     Time operator-(const Time& t)  const;
00041     Time& operator+=(const Time& t);
00042     Time& operator-=(const Time& t);
00043 
00044     bool operator==(const Time& t) const;
00045     bool operator<(const Time& t)  const;
00046     bool operator>(const Time& t)  const;
00047     bool operator>=(const Time& t) const;
00048     bool operator<=(const Time& t) const;
00050 
00051     // Use default operator=
00052 
00054     void cleanup();
00055 };
00056 
00057 } // namespace oasys
00058 
00059 #endif /* __TIME_H__ */

Generated on Fri Dec 22 14:48:01 2006 for DTN Reference Implementation by  doxygen 1.5.1