Namespaces
Variants
Actions

CLOCKS_PER_SEC

From cppreference.com
< cpp‎ | chrono‎ | c
 
C++
 
Date and time library
Time point
(C++11)
(C++20)
Duration
(C++11)
Clocks
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
Time of day
(C++20)(C++20)
(C++20)(C++20)
(C++20)
Calendar
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)(C++20)
chrono I/O
(C++20)

 
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 1'000'000, regardless of the actual precision of std::clock().

[edit] Example

#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';
}

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

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant