Namespaces
Variants

std::chrono::system_clock:: now

From cppreference.net

(depuis C++11)

Retourne un point temporel représentant l'instant actuel.

Valeur de retour

Un point temporel représentant l'heure actuelle.

Exemple

#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);
}

Sortie possible :

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