Time Library#

2026-10-07

1 min read time

Applies to Linux and Windows

This page documents the time library headers available in libhipcxx, covering chrono clocks, durations, and time points.

See the documentation of the standard header <chrono>

Header

Content

Availability

<cuda/std/chrono>

Times, dates, and clocks

libhipcxx 2.7

Implementation-defined behavior#

system_clock#

std::chrono::system_clock tracks real-world time. The C++ Standard leaves it unspecified whether the clock increases monotonically. In libhipcxx it does not, so is_steady is false.

  • In host code, system_clock::now() returns the time point of the host standard library’s std::chrono::system_clock.

  • In device code, it reads HIP’s wall_clock64(), which ticks at a constant rate and increases monotonically.

The device clock does not count from the UNIX epoch and is not synchronized with the host clock, so time points obtained in device code cannot be compared with time points obtained in host code. The two clocks may also tick at different rates. See Limitations and unsupported APIs.

high_resolution_clock#

std::chrono::high_resolution_clock is an alias for system_clock, so it counts real-world time and is_steady is false. It is steady within device code, which makes it suitable for measuring elapsed time inside a kernel.

Omissions#

The following facilities from section time.syn of the C++ Standard are not available in libhipcxx:

  • std::chrono::steady_clock, a monotonically increasing clock. libhipcxx provides no clock that is steady across host and device, because the device clock is neither synchronized with the host clock nor guaranteed to tick at the same rate.

  • std::chrono::duration I/O operators, which would require a heterogeneous C++ I/O streams implementation.