-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTimeStamp.hh
More file actions
74 lines (61 loc) · 1.85 KB
/
Copy pathTimeStamp.hh
File metadata and controls
74 lines (61 loc) · 1.85 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
* TimeStamp.hh
*
* Copyright 2001, LifeLine Networks BV (www.lifeline.nl). All rights reserved.
* Copyright 2001, Bastiaan Bakker. All rights reserved.
*
* See the COPYING file for the terms of usage and distribution.
*/
#ifndef _LOG4CPP_TIMESTAMP_HH
#define _LOG4CPP_TIMESTAMP_HH
#include <log4cpp/Portability.hh>
namespace log4cpp {
/**
* A simple TimeStamp abstraction
**/
class LOG4CPP_EXPORT TimeStamp {
public:
/**
Constructs a TimeStamp representing 'now'.
**/
TimeStamp();
/**
Constructs a TimeStamp representing the given offset since the
epoch ( 00:00:00 1970/1/1 UTC).
**/
TimeStamp(unsigned int seconds, unsigned int microSeconds = 0);
/**
Returns the 'seconds' part of the TimeStamp.
**/
inline int getSeconds() const {
return _seconds;
};
/**
Returns the 'subseconds' part of the TimeStamp in milliseconds,
getMilliSeconds() == getMicroSeconds() / 1000.
**/
inline int getMilliSeconds() const {
return _microSeconds / 1000;
};
/**
Returns the subsecond part of the TimeStamp in microseconds.
The actual precision of this value depends on the platform and
may be in the order of milliseconds rather than microseconds.
**/
inline int getMicroSeconds() const {
return _microSeconds;
};
/**
Returns a TimeStamp representing the time at which the application
started.
**/
static inline const TimeStamp& getStartTime() {
return _startStamp;
};
protected:
static TimeStamp _startStamp;
int _seconds;
int _microSeconds;
};
}
#endif // _LOG4CPP_TIMESTAMP_HH