Easily measure elapsed time

前端 未结 26 2185
栀梦
栀梦 2020-11-22 04:13

I am trying to use time() to measure various points of my program.

What I don\'t understand is why the values in the before and after are the same? I understand thi

26条回答
  •  心在旅途
    2020-11-22 04:58

    Windows only: (The Linux tag was added after I posted this answer)

    You can use GetTickCount() to get the number of milliseconds that have elapsed since the system was started.

    long int before = GetTickCount();
    
    // Perform time-consuming operation
    
    long int after = GetTickCount();
    

提交回复
热议问题