📄 time.cpp
字号:
// Time.cpp: implementation of the Time class.
//
//////////////////////////////////////////////////////////////////////
#include "Time.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
Time::Time()
{
}
Time::~Time()
{
}
void Time::CurTime()
{
time_t tt;
tt=time(&tt);
struct tm *t=localtime(&tt);
hour=t->tm_hour;
min=t->tm_min;
sec=t->tm_sec;
}
int Time::operator < (Time & t2)
{
if(hour < t2.hour)
return 1;
else if(hour > t2.hour)
return -1;
else if(min < t2.min)
return 1;
else if(min > t2.min)
return -1;
else if(sec < t2.sec)
return 1;
else if(sec > t2.sec)
return -1;
else return 0;
}
bool Time::operator > (Time & t2)
{
if(hour > t2.hour)
return true;
else if(hour < t2.hour)
return false;
else if(min > t2.min)
return true;
else if(min < t2.min)
return false;
else if(sec > t2.sec)
return true;
else if(sec < t2.sec)
return false;
else return false;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -