-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTimestamp.h
40 lines (29 loc) · 891 Bytes
/
Timestamp.h
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
#pragma once
#include"BaseLib/CommonDefines.h"
#include"BaseLib/Export.h"
namespace BaseLib {
class Duration;
class DLL_STATE Timestamp : public TimePointNs
{
public:
Timestamp(TimePointNs timestamp = Clock::now());
virtual ~Timestamp();
Duration TimeSinceEpoch() const;
Duration SinceStamped() const;
// -----------------------------------------
// Factory functions
// -----------------------------------------
static Timestamp Now();
static Timestamp NowPlusMilliseconds(int64 msecs);
static Timestamp NowMinusMilliseconds(int64 msecs);
std::string ToString() const;
// -----------------------------------------
// friend operators
// -----------------------------------------
friend std::ostream& operator<<(std::ostream& ostr, const Timestamp& t)
{
ostr << t.ToString();
return ostr;
}
};
}