]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
time: Change temporary variable types in time decode
authorAdam C. Emerson <aemerson@redhat.com>
Thu, 31 Mar 2016 18:50:06 +0000 (14:50 -0400)
committerAdam C. Emerson <aemerson@redhat.com>
Mon, 4 Apr 2016 14:56:30 +0000 (10:56 -0400)
Since we're decoding 32-bit integers, just use uint32_t and then cast them to
what utime_t expects.

Fixes: http://tracker.ceph.com/issues/15330
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
src/common/ceph_time.h

index ef187c0a83f4b6dac90a27a6d8d57bd1d95be853..2c7061a610afed06d3d5ec4642b82ade44d2fec8 100644 (file)
@@ -382,10 +382,13 @@ void encode(const std::chrono::time_point<Clock, Duration>& t,
 template<typename Clock, typename Duration>
 void decode(std::chrono::time_point<Clock, Duration>& t,
            bufferlist::iterator& p) {
-  uint32_t s, ns;
+  uint32_t s;
+  uint32_t ns;
   ::decode(s, p);
   ::decode(ns, p);
-  struct timespec ts = {s, ns};
+  struct timespec ts = {
+    static_cast<time_t>(s),
+    static_cast<long int>(ns)};
 
   t = Clock::from_timespec(ts);
 }