Sub-millisecond precision timing in C or C++

前端 未结 9 1031
天命终不由人
天命终不由人 2020-12-03 15:37

What techniques / methods exist for getting sub-millisecond precision timing data in C or C++, and what precision and accuracy do they provide? I\'m looking for methods tha

9条回答
  •  爱一瞬间的悲伤
    2020-12-03 16:09

    You may try the following:

    struct timeval t; gettimeofday(&t,0x0);

    This gives you current timestamp in micro-seconds. I am not sure about the accuracy.

提交回复
热议问题