]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
log: fix build on osx 18213/head
authorKefu Chai <kchai@redhat.com>
Tue, 10 Oct 2017 07:37:50 +0000 (15:37 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 10 Oct 2017 07:41:56 +0000 (15:41 +0800)
commitf29d304af4522bffa46729c29e28c1c24368ee59
tree7caf0472d6229904f2a1b4e1487ab8f63f88d22e
parent980f18d319e2a59333f76d60835e77e7f617a9a5
log: fix build on osx

we can not assume that the the `rep` type is identical to `time_t` and
`susecond_t`, on osx they are `int`, not `int64_t`. so cast they as
necessary.

this fixes the error and warning of

LogClock.h:112:7: error: non-constant-expression cannot be narrowed from type 'rep' (aka 'long long') to '__darwin_suseconds_t' (aka 'int') in initializer list [-Wc++11-narrowing]
             std::chrono::duration_cast<std::chrono::microseconds>(
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/kefu/dev/ceph/src/log/LogClock.h:112:7: note: insert an explicit cast to silence this issue
             std::chrono::duration_cast<std::chrono::microseconds>(
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LogClock.h:139:46: warning: format specifies type 'long' but the argument has type 'int' [-Wformat]
                      bdt.tm_hour, bdt.tm_min, bdt.tm_sec, tv.tv_usec / 1000);
                                                           ^~~~~~~~~~~~~~~~~

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/log/LogClock.h