1 /*
2  * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
3  *               Alexander Warg <warg@os.inf.tu-dresden.de>
4  *     economic rights: Technische Universität Dresden (Germany)
5  * This file is part of TUD:OS and distributed under the terms of the
6  * GNU Lesser General Public License 2.1.
7  * Please see the COPYING-LGPL-2.1 file for details.
8  */
9 #include <sys/time.h>
10 #include <time.h>
11 #include <l4/re/env.h>
12 
gettimeofday(struct timeval * tv,struct timezone * tz)13 int gettimeofday(struct timeval *tv, struct timezone *tz)
14 {
15   struct timespec ts;
16   int e = clock_gettime(CLOCK_REALTIME, &ts);
17 
18   (void)tz;
19   if (e < 0)
20     return e;
21 
22   if (tz)
23     tz->tz_minuteswest = tz->tz_dsttime = 0;
24 
25   tv->tv_sec  = ts.tv_sec;
26   tv->tv_usec = ts.tv_nsec / 1000;
27   return 0;
28 }
29