问个定时执行某代码段的有关问题

问个定时执行某代码段的问题
我有一个代码段是这样的(当然我也可以把这段封装成函数):

while(1)
{
CURL *curl;   
CURLcode res;    
struct curl_slist *http_header = NULL;   

curl = curl_easy_init();   
curl_easy_setopt(curl, CURLOPT_POST, 1); 
curl_easy_setopt(curl, CURLOPT_URL, POSTURL);   
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, POSTFIELDS);   
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
curl_easy_setopt(curl, CURLOPT_HEADER, 1);   
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);    
res = curl_easy_perform(curl);

curl_easy_setopt(curl, CURLOPT_POST, 1); 
curl_easy_setopt(curl, CURLOPT_URL, POSTURL2);   
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, POSTFIELDS2);   
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
curl_easy_setopt(curl, CURLOPT_HEADER, 1);   
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);    
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);

...// 其他部分代码
}


我想这段代码是定时,比如间隔24个小时才执行;
而后面的其他部分可能需要每隔5分钟就执行一次。

在windows api中可以使用time事件;
但是我目前需要他既可以在windows上运行,同时又需要在linux上运行

所以不知道,要怎么处理一下。
因此,来提个问,问问各位!问个定时执行某代码段的有关问题
定时器 time事件

------解决方案--------------------
自己写一个class,里面计算time事件,(当24个小时)用异步的方式,回调这个函数
当然你底下的部分和这个class需要用线程分开