summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/common/gettimeofday.c
blob: 12473a8e62b6d1fdfd40d9ce4bfdba2110866637 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
 * gettimeofday() for uClibc
 *
 * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
 *
 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 */

#include <sys/syscall.h>
#include <sys/time.h>

#ifdef SHARED
#include "ldso.h"
#endif


#ifdef __VDSO_SUPPORT__
typedef int (*gettimeofday_func)(struct timeval * tv, __timezone_ptr_t tz);
#endif

int gettimeofday(struct timeval * tv, __timezone_ptr_t tz) {

    #ifdef __VDSO_SUPPORT__
        if ( _dl__vdso_gettimeofday != 0 ){
            gettimeofday_func func= _dl__vdso_gettimeofday;
            return func( tv, tz );

        }else{
            _syscall2_body(int, gettimeofday, struct timeval *, tv, __timezone_ptr_t, tz)
        }
    #else
        _syscall2_body(int, gettimeofday, struct timeval *, tv, __timezone_ptr_t, tz)
    #endif
}


libc_hidden_def(gettimeofday)