sapling/eden/fs/utils/Clock.cpp
Xavier Deguillard b961901bb9 utils: remove UnixClock::getElapsedTimeInNs
Summary:
Replace it by simply using std::chrono facilities to achieve the exact same
behavior.

Reviewed By: chadaustin

Differential Revision: D24027637

fbshipit-source-id: d22eefec5d408ead0b4cfaa20e716f4c10cce0b5
2020-09-30 15:50:08 -07:00

30 lines
597 B
C++

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
#ifdef _WIN32
#include "folly/portability/Time.h"
#endif
#include <chrono>
#include <system_error>
#include "Clock.h"
namespace facebook {
namespace eden {
timespec UnixClock::getRealtime() const {
timespec rv;
if (clock_gettime(CLOCK_REALTIME, &rv)) {
throw std::system_error(
errno, std::generic_category(), "clock_gettime failed");
}
return rv;
}
} // namespace eden
} // namespace facebook