timespec equivalent for windows

后端 未结 2 1088
故里飘歌
故里飘歌 2020-12-16 05:40

I am porting my application to windows from unix and I have run into a wall. In my application I need to find time in microseconds (the whole appli

2条回答
  •  盖世英雄少女心
    2020-12-16 06:36

    Portable between Windows, UNIX, Linux and anything vaguely modern: std::chrono::high_resolution_clock. Resolution may vary, but you can find out at compile time what it is. Nanoseconds is certainly possible on modern hardware.

    Keep in mind that nanosecond precision really means a sub-meter precision. A nanosecond at lightspeed is only 30 centimeters. Moving your computer from the top of rack to the bottom is literally moving it by several nanoseconds.

提交回复
热议问题