sapling/eden/fs/utils/Clock.cpp
Adam Simpkins 00a232d868 make Clock::getRealtime() const
Summary: This API seems like it should be const, as it does not modify the clock.

Reviewed By: chadaustin, zhupanov

Differential Revision: D6869719

fbshipit-source-id: c8bf4ccab34538b59e6baeedd0b0ff88b328236e
2018-02-01 11:19:15 -08:00

28 lines
659 B
C++

/*
* Copyright (c) 2017-present, 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.
*
*/
#include "Clock.h"
#include <system_error>
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