clock_gettime
函数来获取高精度的当前时间,包括毫秒数。,,``c,#include,#include,,int main() {, struct timespec ts;, clock_gettime(CLOCK_REALTIME, &ts);, printf("Current time: %ld milliseconds\n", ts.tv_sec * 1000 + ts.tv_nsec / 1000000);, return 0;,},
``,,这段代码会输出当前的毫秒数。