double difftime(time_t timer1, time_t timer0);
Parameter:
time1: mốc thời gian thứ nhất
time2: mốc thời gian thứ hai
Remark:
Hàm difftime( ) sẽ trả về khoảng thời gian (tính bằng giây) giữa 2 mốc timer1 và timer2.
Ví dụ:
#include "stdio.h" #include "conio.h" #include "time.h" void main( void ) { time_t ltime0, ltime1; long i = 600000000L; time(<ime0); while(i--); time(<ime1); printf("\nDuration between ltime0 and ltime1 is: %f seconds", difftime(ltime1, ltime0)); getch(); }
Kết quả:
Leave a Reply
You must be logged in to post a comment.