CLOCKS_PER_SEC - cppreference.com (original) (raw)
From cppreference.com
C-style date and time utilities
| Functions |
|---|
| Time manipulation |
| difftime |
| time |
| clock |
| timespec_get(C++17) |
| Format conversions |
| asctime |
| ctime |
| strftime |
| wcsftime |
| gmtime |
| localtime |
| mktime |
| Constants |
| CLOCKS_PER_SEC |
| Types |
| tm |
| time_t |
| clock_t |
| timespec(C++17) |
| Defined in header | | | | ----------------------------------------------------------------------- | | | | #define CLOCKS_PER_SEC /* implementation-defined */ | | |
Expands to an expression (not necessarily a compile-time constant) of type std::clock_t equal to the number of clock ticks per second, as returned by std::clock().
[edit] Notes
POSIX defines CLOCKS_PER_SEC as 1'000'000, regardless of the actual precision of std::clock().
[edit] Example
Run this code
#include #include #include int main() { const std::clock_t cps{CLOCKS_PER_SEC}; std::cout.imbue(std::locale("en_US.utf8")); std::cout << cps << '\n'; }
Possible output:
1,000,000
[edit] See also
| clock | returns raw processor clock time since the program is started (function) [edit] |
|---|---|
| clock_t | process running time (typedef) [edit] |
| C documentation for CLOCKS_PER_SEC |
Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/chrono/c/CLOCKS_PER_SEC&oldid=180493"