kupl_get_wtime
获取当前时间(秒)。
接口定义
int kupl_get_wtime();
返回值
- 返回当前的时间(秒)
示例
1 2 3 4 5 6 7 8 9 10 11 12 13 | #include <stdio.h> #include <assert.h> #include <unistd.h> #include "kupl.h" int main() { double start = kupl_get_wtime(); usleep(1000001); double end = kupl_get_wtime(); assert(end - start >= 1); return 0; } |
- 上述示例演示了获取当前时间(秒)的流程。
- 上述kupl_get_wtime函数获取当前的时间,通过两次调用该函数的返回值的差值得到时间间隔。
父主题: 公共函数