首页 > 解决方案 > 如何每分钟标记一个时间戳?

问题描述

使用 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

解决方案


推荐阅读