SYSTEMTIME  sysTime1;
 SYSTEMTIME  sysTime2;
怎么去计算两个时间的时间差
有比较好的办法吗时间差的类型仍然是  SYSTEMTIME;

解决方案 »

  1.   

    time_t是long型,可以直接相减
      

  2.   

    GetTickCount函数,判断2次GetTickCount函数之差。
      

  3.   

    可以SystemTimeToFileTime转成FILETIME来计算。
      

  4.   

    SYSTEMTIME?这是不建议直接加减的
    看MSDN说明Res
    It is not recommended that you add and subtract values from this structure to obtain relative times. The following list shows tasks to perform instead: Convert the SYSTEMTIME structure to a FILETIME structure. 
    Copy the resulting FILETIME structure to a ULARGE_INTEGER structure. 
    Use usual 64-bit arithmetic on the ULARGE_INTEGER value
      

  5.   

    GetTickCount只能获得当前tick,人家不是计算那个啦
      

  6.   


    没注意看,呵呵,那就用CTime 或者time_t等类型吧,如果非要用SYSTEMTIME类型那就 按3、4楼说的做。
      

  7.   


    FILETIME 之间怎么计算
      

  8.   

    FILETIME 之间怎么计算 ??
    FILETIME 是个结构体!
      

  9.   

    typedef struct _FILETIME { 
      DWORD dwLowDateTime; 
      DWORD dwHighDateTime; 
    } FILETIME, FAR *LPFILETIME;
    这样就该明白了吧~