starttime= CTime::GetCurrentTime(); 
endtime= CTime::GetCurrentTime(); 
result=endtime-starttime;
请问怎么将这个result转化为秒?

解决方案 »

  1.   

    好像上面的 “-” 无法实现,
    那么我怎样得到starttime到endtime之间的时间间隔(单位为秒):
    starttime= CTime::GetCurrentTime(); 
    endtime= CTime::GetCurrentTime(); 
      

  2.   

    time_t starttime,endtime;
    time(&starttime);
    ......
    time(&endtime);
    endtime-starttime;
      

  3.   

    // example for CTime::operator  +, -
    CTime t1( 1999, 3, 19, 22, 15, 0 ); // 10:15PM March 19, 1999
    CTime t2( 1999, 3, 20, 22, 15, 0 ); // 10:15PM March 20, 1999
    CTimeSpan ts = t2 - t1;  // Subtract 2 CTimes
    ASSERT( ts.GetTotalSeconds() == 86400L );
    ASSERT( ( t1 + ts ) == t2 );  // Add a CTimeSpan to a CTime.
    ASSERT( ( t2 - ts ) == t1 );  // Subtract a CTimeSpan from a Ctime.