t = time (NULL);
senttime = tm.tm_min;
while (1)
{
t = time (NULL);
memcpy (&tm, localtime (&t), sizeof (struct tm));
timer = tm.tm_min - senttime;
if (timer < 0 )
{
timer = timer + 60;
}
printf("timer is %d\n",timer);
if (timer >= timezone)
{
sigalrm_fn();
senttime = tm.tm_min;
}
sleep(60);
};谁能解释一下这段代码实现的意思啊,谢谢各位大侠了 啊 |