mirror of
https://github.com/facebook/rocksdb.git
synced 2024-11-30 04:41:49 +00:00
18285c1e2f
Summary: Make RocksDb build and run on Windows to be functionally complete and performant. All existing test cases run with no regressions. Performance numbers are in the pull-request. Test plan: make all of the existing unit tests pass, obtain perf numbers. Co-authored-by: Praveen Rao praveensinghrao@outlook.com Co-authored-by: Sherlock Huang baihan.huang@gmail.com Co-authored-by: Alex Zinoviev alexander.zinoviev@me.com Co-authored-by: Dmitri Smirnov dmitrism@microsoft.com
50 lines
1.3 KiB
C++
50 lines
1.3 KiB
C++
// Copyright (c) 2013, Facebook, Inc. All rights reserved.
|
|
// This source code is licensed under the BSD-style license found in the
|
|
// LICENSE file in the root directory of this source tree. An additional grant
|
|
// of patent rights can be found in the PATENTS file in the same directory.
|
|
//
|
|
// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file. See the AUTHORS file for names of contributors.
|
|
|
|
// This file is a portable substitute for sys/time.h which does not exist on Windows
|
|
|
|
#ifndef STORAGE_LEVELDB_PORT_SYS_TIME_H_
|
|
#define STORAGE_LEVELDB_PORT_SYS_TIME_H_
|
|
|
|
#if defined(_WIN32) && defined(_MSC_VER)
|
|
|
|
#include <time.h>
|
|
|
|
namespace rocksdb {
|
|
|
|
namespace port {
|
|
|
|
// Avoid including winsock2.h for this definition
|
|
typedef struct timeval {
|
|
long tv_sec;
|
|
long tv_usec;
|
|
} timeval;
|
|
|
|
void gettimeofday(struct timeval* tv, struct timezone* tz);
|
|
|
|
inline
|
|
struct tm* localtime_r(const time_t *timep, struct tm *result) {
|
|
errno_t ret = localtime_s(result, timep);
|
|
return (ret == 0) ? result : NULL;
|
|
}
|
|
|
|
}
|
|
|
|
using port::timeval;
|
|
using port::gettimeofday;
|
|
using port::localtime_r;
|
|
}
|
|
|
|
#else
|
|
# include <time.h>
|
|
# include <sys/time.h>
|
|
#endif
|
|
|
|
#endif // STORAGE_LEVELDB_PORT_SYS_TIME_H_
|