简体   繁体   English

以分钟为单位测量时间

[英]Measure time in minutes in C

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 wondering how to do the breaks. 确切地说,它将等待10分钟,执行一些代码,等待2分钟,执行更多代码,并重复5次(有人猜到我想做什么?),我想知道如何做些休息。

Thanks in advance! 提前致谢!

Oh, and by the way, I'm on Mac. 哦,顺便说一句,我在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) (1秒= 1000)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM