File: clock.cc

package info (click to toggle)
c%2B%2B-annotations 12.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 13,044 kB
  • sloc: cpp: 24,337; makefile: 1,517; ansic: 165; sh: 121; perl: 90
file content (52 lines) | stat: -rw-r--r-- 1,298 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52

#include <iostream>
#include <chrono>
#include <filesystem>

using namespace std;
using namespace chrono;
using namespace filesystem;

auto local_time_point(time_point<system_clock> const &tp, char const *fmt)
{
    time_t secs = system_clock::to_time_t( tp );
    return put_time(localtime(&secs), fmt);
}

int main()
{
//    system_clock::duration ds{ 24h };
//    __file_clock::duration df{ 1h };

    system_clock::from_time_t(
        system_clock::to_time_t(
            system_clock::from_time_t(
                12345
            )
        )
    );

        std::time_t tm {time(0)};
        std::cout << std::put_time(std::localtime(&tm), "%c") << '\n';

    time_t secs = system_clock::to_time_t( system_clock::now() );
    cout << put_time(std::localtime(&secs), "%c\n");

    cout << local_time_point(system_clock{}.now(), "%c") << '\n';

//    __file_clock::to_time_t(__file_clock::from_time_t(12345));
    high_resolution_clock::to_time_t(high_resolution_clock::from_time_t(12345));
//    steady_clock::to_time_t(steady_clock::from_time_t(12345));

//    unsigned uval = system_clock::period::num;

//    __file_clock::period rf;


//    system_clock::rep vs;
//    __file_clock::rep vf;

//    system_clock::time_point st = system_clock{}.now();

    __file_clock::time_point ft;
}