Merge pull request #512 from ggtakec/master

Changed clock_gettime func to s3fs_clock_gettime for homebrew - #468
This commit is contained in:
Takeshi Nakatani 2016-12-04 19:42:29 +09:00 committed by GitHub
commit a00af2385b

View File

@ -56,8 +56,13 @@ using namespace std;
#define CLOCK_MONOTONIC_COARSE CLOCK_MONOTONIC
#endif
#ifndef HAVE_CLOCK_GETTIME
static int clock_gettime(int clk_id, struct timespec* ts)
#ifdef HAVE_CLOCK_GETTIME
static int s3fs_clock_gettime(int clk_id, struct timespec* ts)
{
return clock_gettime(clk_id, ts);
}
#else
static int s3fs_clock_gettime(int clk_id, struct timespec* ts)
{
struct timeval now;
if(0 != gettimeofday(&now, NULL)){
@ -71,7 +76,7 @@ static int clock_gettime(int clk_id, struct timespec* ts)
inline void SetStatCacheTime(struct timespec& ts)
{
if(-1 == clock_gettime(CLOCK_MONOTONIC_COARSE, &ts)){
if(-1 == s3fs_clock_gettime(CLOCK_MONOTONIC_COARSE, &ts)){
ts.tv_sec = time(NULL);
ts.tv_nsec = 0;
}