]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
time: Properly expose coarse clocks and timepoints
authorAdam C. Emerson <aemerson@redhat.com>
Mon, 14 Mar 2016 17:43:31 +0000 (13:43 -0400)
committerAdam C. Emerson <aemerson@redhat.com>
Wed, 16 Mar 2016 15:16:58 +0000 (11:16 -0400)
Fix a typo and add a missing typedef.

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
src/common/ceph_time.cc
src/common/ceph_time.h

index 886016552c5a59dda998cbee208715d01538759e..e93dcd97206a13bdbf1e2315946171d541cec99e 100644 (file)
@@ -62,7 +62,7 @@ namespace ceph {
       to_ceph_timespec(t, ts);
       return ts;
     }
-    real_clock::time_point coarse_real_clock::from_ceph_timespec(
+    coarse_real_clock::time_point coarse_real_clock::from_ceph_timespec(
       const struct ceph_timespec& ts) {
       return time_point(seconds(ts.tv_sec) + nanoseconds(ts.tv_nsec));
     }
index ef187c0a83f4b6dac90a27a6d8d57bd1d95be853..6a398fa243946e918e57191a14dcdb555619605f 100644 (file)
@@ -150,7 +150,7 @@ namespace ceph {
       typedef duration::period period;
       // The second template parameter defaults to the clock's duration
       // type.
-      typedef std::chrono::time_point<real_clock> time_point;
+      typedef std::chrono::time_point<coarse_real_clock> time_point;
       static constexpr const bool is_steady = false;
 
       static time_point now() noexcept {
@@ -243,7 +243,7 @@ namespace ceph {
       typedef timespan duration;
       typedef duration::rep rep;
       typedef duration::period period;
-      typedef std::chrono::time_point<mono_clock> time_point;
+      typedef std::chrono::time_point<coarse_mono_clock> time_point;
       static constexpr const bool is_steady = true;
 
       static time_point now() noexcept {
@@ -306,12 +306,14 @@ namespace ceph {
 
   // Actual wall-clock times
   typedef real_clock::time_point real_time;
+  typedef coarse_real_clock::time_point coarse_real_time;
 
   // Monotonic times should never be serialized or communicated
   // between machines, since they are incomparable. Thus we also don't
   // make any provision for converting between
   // std::chrono::steady_clock time and ceph::mono_clock time.
   typedef mono_clock::time_point mono_time;
+  typedef coarse_mono_clock::time_point coarse_mono_time;
 
   template<typename Rep1, typename Ratio1, typename Rep2, typename Ratio2>
   auto floor(const std::chrono::duration<Rep1, Ratio1>& duration,
@@ -363,6 +365,8 @@ namespace ceph {
   std::ostream& operator<<(std::ostream& m, const timespan& t);
   std::ostream& operator<<(std::ostream& m, const real_time& t);
   std::ostream& operator<<(std::ostream& m, const mono_time& t);
+
+  // To gain sane behavior with signs
 } // namespace ceph
 
 // We need these definitions to be able to hande ::encode/::decode on