TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/X-ARTEMIS/ASTD/llms.txt
Use this file to discover all available pages before exploring further.
astd/time/time.hpp header exposes two functions inside the astd namespace for querying the current system clock. Both functions wrap the C++20 <chrono> facilities and offer an opt-in local flag that converts the result from UTC to the system’s local timezone. When local is false (the default), each function returns a standard std::chrono::system_clock::time_point suitable for serialisation, logging, or further <chrono> arithmetic.
Local timezone conversion (
local = true) relies on the C++20 timezone
database (std::chrono::current_zone). This requires a C++20-capable
compiler and, on some platforms (notably MSVC before VS 2019 16.10 and
certain Linux distros), a separately installed timezone data package. Confirm
your toolchain supports <chrono> timezone facilities before using the local
overloads.astd::getSystemTime
Returns the current system clock time with full sub-second precision.
std::chrono::system_clock::now(). When local is true, the result is passed through std::chrono::current_zone()->to_local(...) to produce a local-timezone time point.
When
false (default), returns a UTC std::chrono::system_clock::time_point.
When true, converts the UTC time point to the host system’s local timezone
using std::chrono::current_zone()->to_local(...).The current system time at whatever precision
system_clock provides on the
target platform (typically nanoseconds or microseconds). When local = true,
the returned type is a std::chrono::local_time specialisation rather than
a plain system_clock::time_point.astd::getSystemTrimmedTime
Returns the current system clock time truncated to whole-second precision.
std::chrono::time_point_cast<std::chrono::seconds>(...) to strip the sub-second component before returning. Use it when you need timestamps that are clean for human-readable output, second-granularity logging, or comparisons where fractional seconds add noise.
When
false (default), returns a UTC time point cast to second precision.
When true, truncates first and then converts to the local timezone via
std::chrono::current_zone()->to_local(...).time_point
std::chrono::time_point<std::chrono::system_clock, std::chrono::seconds> (UTC) or local equivalent
The current system time with the sub-second remainder discarded. The
duration tick period is guaranteed to be
std::chrono::seconds.Usage example
Comparison of the two functions
getSystemTime | getSystemTrimmedTime | |
|---|---|---|
| Precision | Full (system_clock native) | Seconds only |
| Sub-second data | Preserved | Discarded via time_point_cast |
| Typical use case | Benchmarking, profiling, high-res logs | Human-readable timestamps, second-granularity comparisons |
| Local timezone | Supported (local = true) | Supported (local = true) |
| C++ standard required | C++20 (for local = true) | C++20 (for local = true) |