linux - 将 VC++ SetWaitableTimer 移植到 gcc

标签 linux visual-c++ gcc porting

我有使用 SetWaitableTimer 的遗留代码在午夜后 10 秒执行一些任务。

SetWaitableTimer 具有以下功能,在代码中使用:

If the system time is adjusted, the due time of any outstanding absolute timers is adjusted.

我正在将代码移植到 gcc/Linux。我如何模拟上述行为?

最佳答案

This是对 Linux 定时器功能的一个很好的概述。你想要 timer_create() / timer_delete() CLOCK_REALTIME 系列,然后是 timer_settime()使用 TIMER_ABSTIME。根据this FAQ如果系统时钟发生变化,应该进行调整,但我从未测试过。

关于linux - 将 VC++ SetWaitableTimer 移植到 gcc,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4620166/

相关文章:

c++ - Windows应用程序中的键盘类实现

c - while(i--) 通过 gcc 和 clang 优化 : why don't they use sub/jnc?

python - python程序中的Bash

c++ - 在 Visual C++ 中使用 union

linux - 在 sqlite 数据库之间传输数据

c++ - 部署后,简单的C++ ofstream项目无法正常工作

c - 如何使用编译器的命令行选项禁用 volatile 存储类?

c - GCC 打印 cc1 而不是行号

linux - 检查监视器 : must be configured to display at least 256 colors. 未设置显示环境变量。失败<<<<

linux - 将文件名参数从 Bash 传递到 Perl