SimTime.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00030
00032
00033
00034 #ifndef __SIM_TIME_H_
00035 #define __SIM_TIME_H_
00036
00037 #ifdef MIP_HOST_APPLE
00038 #include <applePatch.h>
00039 #endif
00040
00041 #include "Time.h"
00042
00043 using namespace std;
00044
00048
00050
00051
00052
00053 namespace MipBaselib {
00054
00055
00056
00057 class SimTime: public Time{
00058
00059 static long int _simSec;
00060 static long int _simUsec;
00061 static bool _realTime;
00062
00063 public:
00065 SimTime();
00066
00067 SimTime(long int s,long int u);
00068
00070 SimTime(Decimal t);
00071
00073 SimTime(const SimTime& t);
00074
00076 SimTime(const Time& t);
00077
00079 SimTime(stringstream& ss);
00080
00084 void setSimulatedTime(Time t);
00085
00088 void setRealTime();
00089 };
00090
00091
00092
00093
00094
00097 class SimTimer{
00098 public:
00100 SimTimer();
00101
00103 SimTimer(Time alreadyElapsed);
00104
00106 SimTimer(const SimTimer& t);
00107
00109 SimTimer& operator=(const SimTimer& t);
00110
00112 void reset();
00113
00117 void pause();
00118
00120 void resume();
00121
00124 Time get();
00125
00127 string print();
00128
00130 Decimal freq();
00131
00133 string printFreq();
00134
00135 private:
00136 struct timeval current;
00137 SimTime _start;
00138 SimTime _accu;
00139 bool _pause;
00140 };
00141
00142
00143
00144 };
00145
00146 #endif
00147
00148
00149
00150