Windows:
在Windows中使用SetTimer()和KillTimer()来实现定时器。
SetTimer有两个函数,一个是全局的函数::SetTimer(), 另外在MFC环境下CWnd中也有定义SetTimer()。
具体用法,参考:http://msdn.microsoft.com/en-us/library/ee503157(v=winembedded.60).aspx
Linux:
在<sys/time.h>中 定义了struct timeval, struct itimeval 以及相应的 setitmer()
signal(SIGALRM, timeout)
setitimer(TIMER_REAL, &timer, NULL)
具体用法,参考:http://www.cnblogs.com/jordan-tao/archive/2012/11/03/linux_sys_times.html