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 */ 5 6 7 #include <sys/time.h> 8 #include <syscalls.h> 9 10 11 int 12 gettimeofday(struct timeval *tv, struct timezone *tz) 13 { 14 if (tv != NULL) { 15 bigtime_t usecs = real_time_clock_usecs(); 16 17 tv->tv_sec = usecs / 1000000; 18 tv->tv_usec = usecs % 1000000; 19 } 20 21 if (tz != NULL) { 22 time_t timezoneOffset; 23 bool daylightSavingTime; 24 _kern_get_timezone(&timezoneOffset, &daylightSavingTime); 25 26 tz->tz_minuteswest = timezoneOffset; 27 tz->tz_dsttime = daylightSavingTime; 28 } 29 30 return 0; 31 } 32