cgv
Loading...
Searching...
No Matches
time_stamp.h
1#pragma once
2
3#include <chrono>
4
5namespace cgv {
6namespace data {
7
8using time_point = std::chrono::high_resolution_clock::time_point;
9
12public:
13 bool is_valid() const {
14 return modified_time_ != time_point::min();
15 }
16
17 void reset() {
18 modified_time_ = time_point::min();
19 }
20
21 void modified() {
22 modified_time_ = std::chrono::high_resolution_clock::now();
23 }
24
25 time_point get_modified_time() const {
26 return modified_time_;
27 }
28
29 bool operator>(const time_stamp& other) {
30 return this->modified_time_ > other.modified_time_;
31 }
32 bool operator<(const time_stamp& other) {
33 return this->modified_time_ < other.modified_time_;
34 }
35
36private:
37 time_point modified_time_ = time_point::min();
38};
39
40} // namespace data
41} // namespace cgv
Keep a time stamp to store modified time of objects.
Definition time_stamp.h:11
this header is dependency free
Definition print.h:11