VC中怎样得到两个时间的时间差(差几秒)? 在VC 中用::GetLocalTime在不同时间得好两个时间量,怎样计算它们的时间差(秒数差,即两个时间差几秒)? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 CTime ct=CTime::GetCurrentTime();...int iSecond=(CTime::GetCurrentTime()-ct).GetSecond(); 最后的应该是GetTotalSeconds();int iSecond=(CTime::GetCurrentTime()-ct).GetTotalSeconds(); 定义CTimeSpan类的对象,就可以了!! 谢谢!顺便修正一下:int iSecond=(CTime::GetCurrentTime()-ct).GetSeconds(); #ifndef Timer_H#define Timer_H#include <windows.h>class Timer{public: Timer() { QueryPerformanceFrequency(&Frequency); } inline void start() { QueryPerformanceCounter(&timerB); } inline double GetTime() { QueryPerformanceCounter(&timerE); return (double)(timerE.QuadPart - timerB.QuadPart) / (double)Frequency.QuadPart * 1000.0; }private: LARGE_INTEGER timerB, timerE, Frequency;};#endif SYSTEMTIME MyTime1,MyTime2; int t1,t2; ::GetLocalTime(&MyTime1); t1=MyTime1.wSecond; ...... ::GetLocalTime(&MyTime2); t2=MyTime2.wSecond; 为什么3个图标与tab选项卡匹配 基于VC++的图像处理问题? 请教一个操作系统线程问题 关于socket中的listen函数问题 文件读写问题 IDE的问题 求助:如何升级我的VC++6.0 为什么会创建adodb.command对象时出错???在线.. 请问知道局域网中机器的mac地址,怎么查ip地址? 关于mfc应用程序框架命令传递的路径问题(看我的下面的代码有没有问题!vc菜鸟) 我将在下周推出免费邮件群发&群收系统. 除了Classwizard,怎么直接设置CheckBox
...
int iSecond=(CTime::GetCurrentTime()-ct).GetSecond();
int iSecond=(CTime::GetCurrentTime()-ct).GetTotalSeconds();
顺便修正一下:
int iSecond=(CTime::GetCurrentTime()-ct).GetSeconds();
int t1,t2;
::GetLocalTime(&MyTime1);
t1=MyTime1.wSecond; ...... ::GetLocalTime(&MyTime2);
t2=MyTime2.wSecond;