Photon Common Library 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
Timestamp.h
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4#include <chrono>
5#include <ctime>
6
7namespace ph
8{
9
15class Timestamp final
16{
17public:
18 Timestamp();
19
20 std::string toYMD() const;
21 std::string toHMS() const;
22 std::string toHMSMilliseconds() const;
23 std::string toHMSMicroseconds() const;
24 std::string toYMDHMS() const;
25 std::string toYMDHMSMilliseconds() const;
26 std::string toYMDHMSMicroseconds() const;
27 std::string toString() const;
28
29private:
30 std::chrono::system_clock::time_point m_time;
31
32 std::time_t toCTime() const;
33 std::string toYMDWithOldAPI() const;
34 std::string toHMSWithOldAPI() const;
35};
36
37// In-header Implementations:
38
40 m_time(std::chrono::system_clock::now())
41{}
42
43inline std::time_t Timestamp::toCTime() const
44{
45 return std::chrono::system_clock::to_time_t(m_time);
46}
47
48}// end namespace ph
Represents a point in time.
Definition Timestamp.h:16
std::string toString() const
Definition Timestamp.cpp:136
std::string toHMSMilliseconds() const
Definition Timestamp.cpp:91
std::string toYMDHMS() const
Definition Timestamp.cpp:121
std::string toYMDHMSMicroseconds() const
Definition Timestamp.cpp:131
std::string toYMDHMSMilliseconds() const
Definition Timestamp.cpp:126
Timestamp()
Definition Timestamp.h:39
std::string toHMS() const
Definition Timestamp.cpp:42
std::string toYMD() const
Definition Timestamp.cpp:27
std::string toHMSMicroseconds() const
Definition Timestamp.cpp:106
The root for all renderer implementations.
Definition assertion.h:9