我在程序里面写了这样一段话: CTime time = GetCurrentTime(); CString str = time.Format(_T("%Y_%m_%d %H:%M:%S")); MessageBox(NULL,str,"caution",MB_OK); CString sss = (time+CTimeSpan(0,0,0,10)).Format(_T("%Y_%m_%d %H:%M:%S")); MessageBox(NULL,sss,"caut",MB_OK); 在我的电脑上得到的两个时间差是10s,但是在另一台电脑上面却得到的两个时间差是2分多,一直很纳闷这个是不是电脑的问题,不知道怎么解决,貌似还有一个奇怪的问题,得到的当前时间是1970年左右(当然这个不是重点),求指教, |
|
40分 |
CTime::GetCurrentTime()
和 GetCurrentTime() 不是一回事! CTime::operator = const CTime& operator =( time_t t ); Remarks These overloaded assignment operators copy the source time into this CTime object. The internal time storage in a CTime object is independent of time zone. Time-zone conversion is not necessary during assignment. Example // example for CTime::operator = CTime Overview | Class Members | Hierarchy Chart See Also CTime::CTime |
恩,试了一下,就是这个原因,两者混淆了,谢谢 |