# CLOCKS_PER_SEC

> C++ Atlas: `cppatlas.com/w/cpp/chrono/c/CLOCKS_PER_SEC` | Source: https://en.cppreference.com/w/cpp/chrono/c/CLOCKS_PER_SEC | Domain: Date and time utilities

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().

## Official Specification Summary (cppreference)

```cpp
// 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()`.

### Notes

POSIX defines CLOCKS_PER_SEC as `1'000'000`, regardless of the actual precision of `std::clock()`.

### Example

```cpp
#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:

```text
1,000,000
```

### See also

- [`clock`](https://en.cppreference.com/w/cpp/chrono/c/clock): returns raw processor clock time since the program is started (function)
- [`clock_t`](https://en.cppreference.com/w/cpp/chrono/c/clock_t): process running time (typedef)
- [C documentation for `CLOCKS_PER_SEC`](https://en.cppreference.com/w/c/chrono/CLOCKS_PER_SEC)

---
Attribution: content from https://en.cppreference.com/w/cpp/chrono/c/CLOCKS_PER_SEC (cppreference.com), licensed under CC-BY-SA 3.0 and GFDL. Modified: converted to markdown, study notes added. Offline snapshot of 9 February 2025.