Дата
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <chrono>
#include <ctime>
using namespace std;
int main()
{
auto timeNow = chrono::system_clock::now();
time_t time = chrono::system_clock::to_time_t(timeNow);
string t = ctime(&time);
cout << t;
}
Tue Jul 2 07:59:40 2024
Проміжок часу
auto start = chrono::system_clock::now();
int x = 0;
for (int i = 0; i < 1000000; i++)
{
x++;
}
auto end = chrono::system_clock::now();
chrono::duration<double> delta = end - start;
cout << delta.count();
0.0025241
Дата в секундах з 1 січня 1970
cout << time(0);
1719897628