ctime已经重载过“-”了,减完了之后用CTimeSpan 的GetTotalSeconds( )GetTotalMinutes( )等 得到具体时间
下面是MSDN:
CTime::operator +, -
CTime operator +( CTimeSpan timeSpan ) const;
CTime operator -( CTimeSpan timeSpan ) const;
CTimeSpan operator -( CTime time ) const;
Remarks
CTime objects represent absolute time. CTimeSpan objects represent relative time. The first two operators allow you to add and subtract CTimeSpan objects to and from CTime objects. The third allows you to subtract one CTime object from another to yield a CTimeSpan object.
Example
// example for CTime::operator +, -
CTime t1( 1999, 3, 19, 22, 15, 0 ); // 10:15PM March 19, 1999
CTime t2( 1999, 3, 20, 22, 15, 0 ); // 10:15PM March 20, 1999
CTimeSpan ts = t2 - t1; // Subtract 2 CTimes
ASSERT( ts.GetTotalSeconds() == 86400L );
ASSERT( ( t1 + ts ) == t2 ); // Add a CTimeSpan to a CTime.
ASSERT( ( t2 - ts ) == t1 ); // Subtract a CTimeSpan from a Ctime.
CTime Overview | Class Members | Hierarchy Chart
#include