c - 如何每分钟标记一个时间戳?
问题描述
使用 c++,usleep() 和 sleep() 不起作用,目前时间戳每秒测量数百次而不是每分钟测量一次
// CPP program to print current date and time
// using time and ctime.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
using namespace std;
int main () {
for( ; ; ){
// declaring argument of time()
time_t my_time = time(NULL);
// ctime() used to give the present time
printf("%s", ctime(&my_time));
}
return 0;
}
解决方案
推荐阅读
- c# - SQL 参数化与使用 string.format
- c# - Service Fabric - 每个服务实例的动态资源管理
- c# - 在 .NET 应用程序中管理数据库访问密码?
- sql - 在 PostgreSQL 中按多个内连接的条件计数
- python-3.x - 镶木地板文件中的python Schema不同
- python-3.x - 类对象不继承其他类属性
- python - 尝试在 Raspberry Pi2 (Stretch) 上使用 Selenium
- python - Python smtplib:无法向手机发送短信
- azure - 限制标签值修改
- javascript - 使用 CSS 的 JavaScript (reactJS) 中的 HTML 到 PDF