Revision 50784a28
include/humotion/timestamp.h | ||
---|---|---|
36 | 36 |
class Timestamp{ |
37 | 37 |
public: |
38 | 38 |
Timestamp(void); |
39 |
Timestamp(int32_t _sec, int32_t _nsec);
|
|
39 |
Timestamp(uint32_t _sec, uint32_t _nsec);
|
|
40 | 40 |
Timestamp(double dsec); |
41 | 41 |
|
42 |
void set(int32_t _sec, int32_t _nsec);
|
|
42 |
void set(uint32_t _sec, uint32_t _nsec);
|
|
43 | 43 |
void set(Timestamp a); |
44 | 44 |
|
45 | 45 |
static Timestamp now(void); |
... | ... | |
55 | 55 |
bool operator== (Timestamp &cmp); |
56 | 56 |
bool operator!= (Timestamp &cmp); |
57 | 57 |
|
58 |
int32_t sec; |
|
59 |
int32_t nsec; |
|
58 |
uint32_t sec;
|
|
59 |
uint32_t nsec;
|
|
60 | 60 |
|
61 | 61 |
}; |
62 | 62 |
|
src/timestamp.cpp | ||
---|---|---|
9 | 9 |
set(now()); |
10 | 10 |
} |
11 | 11 |
|
12 |
Timestamp::Timestamp(int32_t _sec, int32_t _nsec){
|
|
12 |
Timestamp::Timestamp(uint32_t _sec, uint32_t _nsec){
|
|
13 | 13 |
set(_sec, _nsec); |
14 | 14 |
} |
15 | 15 |
|
... | ... | |
26 | 26 |
return Timestamp(tp.tv_sec, tp.tv_nsec); |
27 | 27 |
} |
28 | 28 |
|
29 |
void Timestamp::set(int32_t _sec, int32_t _nsec){
|
|
29 |
void Timestamp::set(uint32_t _sec, uint32_t _nsec){
|
|
30 | 30 |
sec = _sec; |
31 | 31 |
nsec = _nsec; |
32 | 32 |
} |
Also available in: Unified diff