CLOCKS_PER_SEC - cppreference.com (original) (raw)

From cppreference.com

< cpp‎ | chrono‎ | c

C++

Compiler support
Freestanding and hosted
Language
Standard library
Standard library headers
Named requirements
Feature test macros (C++20)
Language support library
Concepts library (C++20)
Diagnostics library
Memory management library
Metaprogramming library (C++11)
General utilities library
Containers library
Iterators library
Ranges library (C++20)
Algorithms library
Strings library
Text processing library
Numerics library
Date and time library
Input/output library
Filesystem library (C++17)
Concurrency support library (C++11)
Execution control library (C++26)
Technical specifications
Symbols index
External libraries

[edit]

Date and time library

Time point time_point(C++11) clock_time_conversion(C++20) clock_cast(C++20) Duration duration(C++11) Clocks system_clock(C++11) steady_clock(C++11) is_clock(C++20) utc_clock(C++20) tai_clock(C++20) high_resolution_clock(C++11) gps_clock(C++20) file_clock(C++20) local_t(C++20) Time of day is_amis_pm(C++20)(C++20) make12make24(C++20)(C++20) hh_mm_ss(C++20) Calendar day(C++20) month(C++20) year(C++20) weekday(C++20) operator/(C++20) year_month_day(C++20) year_month_day_last(C++20) year_month_weekday(C++20) year_month_weekday_last(C++20) weekday_indexed(C++20) weekday_last(C++20) month_day(C++20) month_day_last(C++20) month_weekday(C++20) month_weekday_last(C++20) year_month(C++20) last_speclast(C++20)(C++20) chrono I/O parse(C++20) Time zone tzdb(C++20) tzdb_list(C++20) get_tzdbget_tzdb_listreload_tzdbremote_version(C++20)(C++20)(C++20)(C++20) sys_info(C++20) local_info(C++20) nonexistent_local_time(C++20) ambiguous_local_time(C++20) locate_zone(C++20) current_zone(C++20) time_zone(C++20) choose(C++20) zoned_traits(C++20) zoned_time(C++20) time_zone_link(C++20) leap_second(C++20) leap_second_info(C++20) get_leap_second_info(C++20) C-style date and time

[edit]

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)

[edit]

| 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"