external/libnogg/tools/nogg-benchmark.c
static uint64_t time_now(void)
{
#if defined(__APPLE__)
    return mach_absolute_time();
#elif defined(_WIN32)
    LARGE_INTEGER now_buf;
    QueryPerformanceCounter(&now_buf);
    return now_buf.QuadPart;
#elif defined(__linux__)
    struct timespec ts;
    if (clock_gettime(CLOCK_MONOTONIC_RAW, &ts) == 0
     || clock_gettime(CLOCK_MONOTONIC, &ts) == 0
     || clock_gettime(CLOCK_REALTIME, &ts) == 0) {
        return (uint64_t)ts.tv_sec * UINT64_C(1000000000)
             + (uint64_t)ts.tv_nsec;
    } else {
        struct timeval tv;
        gettimeofday(&tv, NULL);
        return (uint64_t)tv.tv_sec * UINT64_C(1000000000)
             + (uint64_t)tv.tv_usec * 1000;
    }
#else
    return time(NULL);
#endif
}
/**
 * time_now:  Return a timestamp representing the current time.  The value
 * of the timestamp is only meaningful when compared with other timestamps
 * returned by this function.  Note that timestamps may wrap around.
 *
 * [Return value]
 *     Current timestamp, in units specified by time_unit().
 */
Return a timestamp representing the current time.  The value
of the timestamp is only meaningful when compared with other timestamps
returned by this function.  Note that timestamps may wrap around.

[Return value]
Current timestamp, in units specified by time_unit().
Return a timestamp representing the current time . The value of the timestamp is only meaningful when compared with other timestamps returned by this function . Note that timestamps may wrap around . [ Return value ] Current timestamp in units specified by time_unit () .
static uint64_t time_now(void)
{
#if defined(__APPLE__)
    return mach_absolute_time();
#elif defined(_WIN32)
    LARGE_INTEGER now_buf;
    QueryPerformanceCounter(&now_buf);
    return now_buf.QuadPart;
#elif defined(__linux__)
    struct timespec ts;
    if (clock_gettime(CLOCK_MONOTONIC_RAW, &ts) == 0
     || clock_gettime(CLOCK_MONOTONIC, &ts) == 0
     || clock_gettime(CLOCK_REALTIME, &ts) == 0) {
        return (uint64_t)ts.tv_sec * UINT64_C(1000000000)
             + (uint64_t)ts.tv_nsec;
    } else {
        struct timeval tv;
        gettimeofday(&tv, NULL);
        return (uint64_t)tv.tv_sec * UINT64_C(1000000000)
             + (uint64_t)tv.tv_usec * 1000;
    }
#else
    return time(NULL);
#endif
}
static uint64_t time_now ( void ) { #if defined ( __APPLE__ ) return mach_absolute_time ( ) ; #elif defined ( _WIN32 ) LARGE_INTEGER now_buf ; QueryPerformanceCounter ( & now_buf ) ; return now_buf . QuadPart ; #elif defined ( __linux__ ) struct timespec ts ; if ( clock_gettime ( CLOCK_MONOTONIC_RAW , & ts ) == 0 || clock_gettime ( CLOCK_MONOTONIC , & ts ) == 0 || clock_gettime ( CLOCK_REALTIME , & ts ) == 0 ) { return ( uint64_t ) ts . tv_sec * UINT64_C ( 1000000000 ) + ( uint64_t ) ts . tv_nsec ; } else { struct timeval tv ; gettimeofday ( & tv , NULL ) ; return ( uint64_t ) tv . tv_sec * UINT64_C ( 1000000000 ) + ( uint64_t ) tv . tv_usec * 1000 ; } #else return time ( NULL ) ; #endif }
time_now:  Return a timestamp representing the current time.
time_now : Return a timestamp representing the current time .