| // Copyright (c) 2006- Facebook |
| // Distributed under the Thrift Software License |
| // See accompanying file LICENSE or visit the Thrift site at: |
| // http://developers.facebook.com/thrift/ |
| #if defined(HAVE_CLOCK_GETTIME) |
| #elif defined(HAVE_GETTIMEOFDAY) |
| #endif // defined(HAVE_CLOCK_GETTIME) |
| namespace apache { namespace thrift { namespace concurrency { |
| const int64_t Util::currentTime() { |
| #if defined(HAVE_CLOCK_GETTIME) |
| int ret = clock_gettime(CLOCK_REALTIME, &now); |
| toMilliseconds(result, now); |
| #elif defined(HAVE_GETTIMEOFDAY) |
| int ret = gettimeofday(&now, NULL); |
| toMilliseconds(result, now); |
| #error "No high-precision clock is available." |
| #endif // defined(HAVE_CLOCK_GETTIME) |
| }}} // apache::thrift::concurrency |