I am writing a program that will need to measure time in minutes.
To be exact, it will wait 10 minutes, execute some code, wait 2 minutes, execute more code and repeat this 5 times (anyone guess what I'm trying to do?) and I am wonderi开发者_运维知识库ng how to do the breaks.
Thanks in advance!
Oh, and by the way, I'm on Mac.
#include <stdio.h>
#include <unistd.h>
sleep(600); // sleep ten minutes
sleep(120); //sleep two minutes
OR if that doesn't work, it'll be usleep, which takes miliseconds as argument I believe. (1 second = 1000)
sleep(3)
精彩评论