开发者

Measure time in minutes in C

开发者 https://www.devze.com 2022-12-30 05:51 出处:网络
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 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)

0

精彩评论

暂无评论...
验证码 换一张
取 消