vfs: check userland buffers before reading them.
[haiku.git] / src / system / libroot / posix / sys / gettimeofday.c
blob3660e99515ace499058775e0abb88b9e9efbd55c
1 /*
2 * Copyright 2003-2006, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 */
7 #include <sys/time.h>
8 #include <syscalls.h>
11 int
12 gettimeofday(struct timeval *tv, void *tz)
14 if (tv != NULL) {
15 bigtime_t usecs = real_time_clock_usecs();
17 tv->tv_sec = usecs / 1000000;
18 tv->tv_usec = usecs % 1000000;
21 // struct timezone (tz) has been deprecated since long and its exact
22 // semantics are a bit unclear, so we need not bother to deal with it
24 return 0;