Namespaces
Variants
Views
Actions

CLOCKS_PER_SEC

From cppreference.com
< cpp‎ | chrono‎ | c
 
 
Utilities library
Language support
Type support (basic types, RTTI)
Library feature-test macros (C++20)
Dynamic memory management
Program utilities
Coroutine support (C++20)
Variadic functions
Debugging support
(C++26)
Three-way comparison
(C++20)
(C++20)(C++20)(C++20)
(C++20)(C++20)(C++20)
General utilities
Date and time
Function objects
Formatting library (C++20)
(C++11)
Relational operators (deprecated in C++20)
Integer comparison functions
(C++20)(C++20)(C++20)   
(C++20)
Swap and type operations
(C++14)
(C++11)
(C++11)
(C++11)
(C++17)
Common vocabulary types
(C++11)
(C++17)
(C++17)
(C++17)
(C++11)
(C++17)
(C++23)
Elementary string conversions
(C++17)
(C++17)

 
 
C-style date and time utilities
Functions
Time manipulation
Format conversions
Constants
CLOCKS_PER_SEC
Types
(C++17)
 
Defined in header <ctime>
#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 one million, regardless of the actual precision of std::clock().

[edit] Example

#include <clocale>
#include <ctime>
#include <iostream>
 
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

returns raw processor clock time since the program is started
(function) [edit]
process running time
(typedef) [edit]
C documentation for CLOCKS_PER_SEC