std::chrono..._clock::now(3)

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

πŸ’– NAME πŸ’–

okay so bestie, welcome to std::chrono..._clock::now(3) from the C++ Standard Libary manual β€” yes, that's the manual name up top, we're folding it in here instead of copying the whole header line. and the NAME tea is exactly this:

std::chrono::system_clock::now - std::chrono::system_clock::now


✨ Synopsis ✨

static std::chrono::time_point<std::chrono::system_clock> now()
(since C++11)
noexcept;

Returns a time point representing the current point in time. that's it, that's the whole little synopsis moment. ✨


🌸 Parameters 🌸

literally (none) β€” no arguments, no secret bonus params, just a clean little call. 🫢


πŸŽ€ Return value πŸŽ€

A time point representing the current time. yes bestie, it gives you the current time as a time point. πŸ“


πŸ¦‹ Example πŸ¦‹

// Run this code

        #include <chrono>
        #include <iostream>

        int main()
        {
            const auto now = std::chrono::system_clock::now();
            const std::time_t t_c = std::chrono::system_clock::to_time_t(now);
            std::cout << "The system clock is currently at " <<
       std::ctime(&t_c);
        }

🌈 Possible output: 🌈

The system clock is currently at Thu Mar 30 13:28:27 2023

πŸ’– source/version + date: http://cppreference.com, 2024.06.10 β€” that's the footer tea, and this page is officially done. mwah, bye bestie! πŸ’–

πŸ“¦ where this page comes from