命名空间
变体
操作

CLOCKS_PER_SEC

来自 cppreference.cn
< cpp‎ | chrono‎ | c
 
 
 
 
定义于头文件 <ctime>
#define CLOCKS_PER_SEC /* 实现定义 */

展开为一个 std::clock_t 类型的表达式(不一定是编译时常量),其值等于每秒时钟滴答数,由 std::clock() 返回。

[编辑] 注解

POSIX 将 CLOCKS_PER_SEC 定义为 1'000'000,无论 std::clock() 的实际精度如何。

[编辑] 示例

#include <ctime>
#include <iostream>
#include <locale>
 
int main()
{
    const std::clock_t cps{CLOCKS_PER_SEC};
    std::cout.imbue(std::locale("en_US.utf8"));
    std::cout << cps << '\n';
}

可能的输出

1,000,000

[编辑] 参见

返回程序启动以来原始处理器时钟时间
(function) [编辑]
进程运行时间
(typedef) [编辑]