Logo Search packages:      
Sourcecode: pulseaudio version File versions

struct timeval* pa_gettimeofday ( struct timeval *  tv  )  [read]

Return the current timestamp, just like UNIX gettimeofday()

Definition at line 39 of file timeval.c.

                                                    {
#ifdef HAVE_GETTIMEOFDAY
    pa_assert(tv);

    pa_assert_se(gettimeofday(tv, NULL) == 0);
    return tv;
#elif defined(OS_IS_WIN32)
    /*
     * Copied from implementation by Steven Edwards (LGPL).
     * Found on wine mailing list.
     */

#if defined(_MSC_VER) || defined(__BORLANDC__)
#define EPOCHFILETIME (116444736000000000i64)
#else
#define EPOCHFILETIME (116444736000000000LL)
#endif

    FILETIME        ft;
    LARGE_INTEGER   li;
    __int64         t;

    pa_assert(tv);

    GetSystemTimeAsFileTime(&ft);
    li.LowPart  = ft.dwLowDateTime;
    li.HighPart = ft.dwHighDateTime;
    t  = li.QuadPart;       /* In 100-nanosecond intervals */
    t -= EPOCHFILETIME;     /* Offset to the Epoch time */
    t /= 10;                /* In microseconds */
    tv->tv_sec  = (time_t) (t / PA_USEC_PER_SEC);
    tv->tv_usec = (suseconds_t) (t % PA_USEC_PER_SEC);

    return tv;
#else
#error "Platform lacks gettimeofday() or equivalent function."
#endif
}


Generated by  Doxygen 1.6.0   Back to index