Skip to content

Commit d4b02c3

Browse files
committed
add time_stamp api
1 parent 1ee9423 commit d4b02c3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

include/cppredis/unit.hpp

+9
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,15 @@ namespace cpp_redis {
121121
return value;
122122
}
123123

124+
static size_t get_time_stamp()
125+
{
126+
std::chrono::time_point<std::chrono::system_clock, std::chrono::seconds> tp =
127+
std::chrono::time_point_cast<std::chrono::seconds>(std::chrono::system_clock::now());
128+
129+
auto tmp = std::chrono::duration_cast<std::chrono::seconds>(tp.time_since_epoch());
130+
return tmp.count();
131+
}
132+
124133
//正数编负数
125134
constexpr int turn(int a)
126135
{

0 commit comments

Comments
 (0)