fix travis error with init time in mockenv

Summary:
/home/travis/build/facebook/rocksdb/env/mock_env.cc: In member function ‘virtual void rocksdb::{anonymous}::TestMemLogger::Logv(const char*, va_list)’:
/home/travis/build/facebook/rocksdb/env/mock_env.cc:391:53: error: ‘t.tm::tm_year’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
                     static_cast<int>(now_tv.tv_usec));
Closes https://github.com/facebook/rocksdb/pull/2418

Differential Revision: D5193597

Pulled By: maysamyabandeh

fbshipit-source-id: 8801a3ef27f33eb419d534f7de747702cdf504a0
main
Maysam Yabandeh 8 years ago committed by Facebook Github Bot
parent 550a1df72c
commit d4f7731b61
  1. 3
      env/mock_env.cc

3
env/mock_env.cc vendored

@ -379,7 +379,8 @@ class TestMemLogger : public Logger {
gettimeofday(&now_tv, nullptr); gettimeofday(&now_tv, nullptr);
const time_t seconds = now_tv.tv_sec; const time_t seconds = now_tv.tv_sec;
struct tm t; struct tm t;
localtime_r(&seconds, &t); auto ret __attribute__((__unused__)) = localtime_r(&seconds, &t);
assert(ret);
p += snprintf(p, limit - p, p += snprintf(p, limit - p,
"%04d/%02d/%02d-%02d:%02d:%02d.%06d ", "%04d/%02d/%02d-%02d:%02d:%02d.%06d ",
t.tm_year + 1900, t.tm_year + 1900,

Loading…
Cancel
Save