std::time_t(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

okay so bestie πŸ’–, this is the std::time_t(3) page from the C++ Standard Libary manual, and time_t is lowkey having a main character moment. let's get into it ✨

✨ NAME ✨

  • std::time_t β€” std::time_t (that's the whole name, bestie, no notes πŸ’…)

πŸ¦‹ Synopsis πŸ¦‹

here's the vibe check on where it lives and what it looks like:

Defined in header <ctime>
typedef /* unspecified */ time_t;

so time_t is an arithmetic type capable of representing times ✨

the exact type is not defined, but it's almost always an integral value holding the number of seconds β€” and no, we are not counting leap seconds 😭 β€” since 00:00, Jan 1 1970 UTC, corresponding to POSIX time. that's the origin story, periodt.

πŸ’« See also πŸ’«

the girlies in the same friend group are:

  • time β€” returns the current time of the system as time since epoch (function)
  • localtime β€” converts time since epoch to calendar time expressed as local time (function)
  • gmtime β€” converts time since epoch to calendar time expressed as Universal Coordinated Time (function)
  • to_time_t β€” converts a system clock time point to std::time_t β€” [static] (public static member function of std::chrono::system_clock)
  • C documentation for time_t

mwah πŸ’‹ β€” source/version/date check: http://cppreference.com, 2024.06.10, on page std::time_t(3). bye bestie, go flex that <ctime> knowledge 🫢✨

πŸ“¦ where this page comes from