CLOCKS_PER_SEC
来自 cppreference.cn
定义于头文件 <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) | |
关于 CLOCKS_PER_SEC 的 C 文档 for CLOCKS_PER_SEC
|