Fix wall-clock time calculation: use `clock_gettime` instead of `gettimeofday`
In the case of `gettimeofday`, inaccuracies may occur when the system clock is adjusted due to NTP or leap second handling.
As a result, calculating the difference between two time points can produce incorrect values.
Issue #178 was related to this: for very short execution times, the `time-wall` value occasionally appeared as negative.
Therefore, the method of calculating the time difference has been changed from `gettimeofday` to `clock_gettime`.
For more details, please refer to the commit history. :)
Close #178
See also: [POSIX.1-2008 specification for gettimeofday (obsolescent function)](https://pubs.opengroup.org/onlinepubs/9699919799/functions/gettimeofday.html)
合并状态:已合并 合并于 2025-09-01 关闭于 2025-09-01 0 条评论