35 static char timeFormat[];
45 Time() {time.tv_sec=time.tv_usec=0;}
51 Time(
long sec,
long usec) {
61 glong
getSecs()
const {
return time.tv_sec;}
72 g_get_current_time(&time);
112 long double tDD=(
long double)t.
getSecs()+(
long double)t.
getUSecs()*1.e-6;
123 return getTimeString(NULL);
131 time_t timeNow; ::time(&timeNow);
132 struct tm *tmLocal = localtime(&timeNow);
135 string strTime(maxSize,
'\0');
138 ret=strftime((
char*)strTime.c_str(), maxSize, timeFormat, tmLocal);
140 ret=strftime((
char*)strTime.c_str(), maxSize, formatStr, tmLocal);
Time & operator-=(const Time &t)
Time & operator+=(const Time &t)
Time(long sec, long usec)
Time operator-(const Time &t)
static string getTimeString(char *formatStr)
friend ostream & operator<<(ostream &o, const Time &t)
Time operator+(const Time &t)
static string getTimeString()