对C ++的新手。
我有一个CTime
(实际上是一个CTimeEx
)对象。时间值的值为:
CExTime now = now.GetSystemTime();
我收到一个
int
,例如60,以增加该时间;这意味着如果我有12:01:30,那么我想要12:02:30。如何将
int
添加到CTime
?这行得通吗?currBERecored.m_BeUpdateTime = now + secondsFromFile;
最佳答案
您可以通过+
运算符将CTimeSpan添加到CTime
对象。 CTimeSpan
是表示时间间隔的正确类,您可以使用此构造函数构造一定秒数的CTimeSpan:
CTimeSpan(
__time64_t time
) throw( );
在其中时间是所需的秒数。