Easily measure elapsed time

前端 未结 26 2872
栀梦
栀梦 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 05:05

    You can use SFML library, which is Simple and Fast Multimedia Library. It includes many useful and well-defined classes like Clock, Socket, Sound, Graphics, etc. It's so easy to use and highly recommended.

    This is an example for this question.

    sf::Clock clock;
    ...
    Time time1 = clock.getElapsedTime();
    ...
    Time time2 = clock.restart();
    

提交回复
热议问题