一道关于时间函数的C++题 求解!
using standard C++ functions to implement our own DateTime Functions.1.Make a Class to store and provice method to do date and time operations.
CLF_DateTime
2.Time storage accurate to milli-seconds.
2007-11-04 22:29:54.9987
3.Reture String with specific format(reference to CTime:Format)
e.g.
CLF_DateTime a = CLF_DateTime(2007,11,4,22,29,54,9987);
a.Format("yyyy-mm-dd HH:MM:SS");
output:
2007-11-04 22:29:54
4.Provid rouding
CLF_DateTime a = CLF_DateTime(2007,11,4,22,29,54,9987);
CLF_DateTime b = a.Rounding(MUNUTE);
b will be"2007-11-04 22:30:00.0000"
5.Provide Compare functions
CLF_DateTime a = CLF_DateTime(2007,11,4,22,29,54,9987);
CLF_DateTime b = CLF_DateTime(2007,11,4,22,30,00,0000);
int iresult;
iresult=CLF_DateTime::Compare(a,b,MINUTE,ROUNDING);
Results:
(a>b,iresult=1)
(a=b,iresult=0)
(a<b,iresult=-1)