【发布时间】:2012-05-18 16:42:45
【问题描述】:
当我使用“ctime”时,curTime 和 pastTime 得到相同的字符串结果,即使 curTime 和 pastTime 的实际值相差 600 秒。
如何在使用 ctime 时获得相同的字符串时间?
谢谢
struct _timeb timebuffer;
_ftime(&timebuffer);
const time_t curTime = (const time_t)timebuffer.time;
const time_t pastTime = curTime - (const time_t)600;
s.Format("%d %s\n%d %s", curTime, ctime(&curTime), pastTime, ctime(&pastTime) );
MessageBox(s);
【问题讨论】: