hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
time.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_TIME_H
7 #define IROHA_TIME_H
8 
9 #include <chrono>
10 
11 namespace iroha {
12 
13  // timestamps
14  using ts64_t = uint64_t;
15  using ts32_t = uint32_t;
16 
17  namespace time {
18 
23  inline auto now() {
24  return std::chrono::system_clock::now().time_since_epoch()
25  / std::chrono::milliseconds(1);
26  }
27 
32  template <typename T>
33  inline auto now(const T &offset) {
34  return (std::chrono::system_clock::now().time_since_epoch() + offset)
35  / std::chrono::milliseconds(1);
36  }
37 
38  using time_t = decltype(iroha::time::now());
39  } // namespace time
40 } // namespace iroha
41 
42 #endif // IROHA_TIME_H
decltype(iroha::time::now()) time_t
Definition: time.hpp:38
auto now()
Definition: time.hpp:23
uint32_t ts32_t
Definition: time.hpp:15
uint64_t ts64_t
Definition: time.hpp:14
Definition: block_query.hpp:16
auto now(const T &offset)
Definition: time.hpp:33