std::chrono::file_clock(3)
π
std::chrono::file_clock β yeah bestie, it's a cppreference.com page (2024.06.10) and the manpage is literally called std::chrono::file_clock(3), okurrr
okay so picture this: you're deep in C++ Standard Library land and you meet std::chrono::file_clock. She's the clock that the filesystem girlies use. Let me introduce you properly π
β¨ NAME β¨
std::chrono::file_clock β bestie, it's literally std::chrono::file_clock. That's the name. That's the whole thing. Iconic behaviour honestly π
πΈ SYNOPSIS πΈ
Defined in header <chrono>:
using file_clock = /* see below */; (since C++20)
std::chrono::file_clock is an alias for the clock used for std::filesystem::file_time_type. Her epoch? Unspecified. We don't know her birthday and honestly we're not asking π
file_clock meets the TrivialClock requirements. Slay. Requirements: met. Periodt π
π MEMBER TYPES π
Every one of these cuties, accounted for:
repβ a signed arithmetic type representing the number of ticks in the clock'sdurationπ°οΈperiodβ astd::ratiotype representing the tick period of the clock, in seconds β±οΈdurationβstd::chrono::duration<rep, period>, and yeah she's capable of representing negative durations, she contains multitudes πtime_pointβstd::chrono::time_point<std::chrono::file_clock>β
π¦ MEMBER CONSTANTS π¦
constexpr bool is_steady[static] βtrueif the time between ticks is always constant, i.e. calls tonow()return values that increase monotonically even in case of some external clock adjustment, otherwisefalse. It's a public static member constant, no cap π
Not me explainingis_steadylike it's a vibe check β it literally is one. Is the tick interval constant? Isnow()monotonic even if something externally messes with the clock? That's the whole question, bestie π«Ά
π MEMBER FUNCTIONS π
okay so here's the tea β file_clock provides exactly one of the following two pairs of static member functions:
to_utcandfrom_utc; orto_sysandfrom_sys.
One pair. Not both. Exactly one. Choose your fighter π§
Here's everyone in the lineup:
now[static] β returns astd::chrono::time_pointrepresenting the current point in time. Public static member function, serving main character energy β¨to_utc/from_utc[static] (optional) β converts betweenfile_timeandutc_time. Public static member functions πto_sys/from_sys[static] (optional) β converts betweenfile_timeandsys_time. Public static member functions π₯
Heads up βto_utc/from_utcandto_sys/from_sysare marked (optional) in the docs, and remember the rule from up top: she ships with exactly one of those two pairs. Don't come for me if your implementation picked the other one, iykyk π
π THE CUTE SIGN-OFF π
That's the whole page babes β sourced from <rainbow>http://cppreference.com</rainbow>, dated <yellow>2024.06.10</yellow>, and officially filed under std::chrono::file_clock(3). Go forth and timestamp your files, you beautiful genius π
ππ·
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms