Merge branch 'master' of git://localhost/acess2
[tpg/acess2.git] / Usermode / Libraries / libposix.so_src / sys_time.c
1 /*
2  * Acess2 POSIX Emulation
3  * - By John Hodge (thePowersGang)
4  *
5  * sys/time.h
6  * - Timing calls
7  */
8 #include <sys/time.h>
9 #include <acess/sys.h>
10
11 // === CODE ===
12 #if 0
13 int getitimer(int which, struct itimerval *current_value)
14 {
15         
16 }
17
18 int setitimer(int which, const struct itimerval *new_value, struct itimerval *old_value)
19 {
20         
21 }
22 #endif
23
24 int gettimeofday(struct timeval *tv, struct timezone *tz)
25 {
26         const int correction_2k_to_unix = 30*365*24*3600;
27         long long int ts = _SysTimestamp();
28         if( tv )
29         {
30                 tv->tv_sec = ts / 1000 + correction_2k_to_unix;
31                 tv->tv_usec = (ts % 1000) * 1000;
32         }
33         if( tz )
34         {
35                 // TODO: Determine timezone?
36                 tz->tz_minuteswest = 0;
37                 tz->tz_dsttime = 0;
38         }
39         return 0;
40 }
41
42 // ifdef _BSD_SOURCE
43 //int settimeofday(const struct timeval *tv, const struct timezone *tz);

UCC git Repository :: git.ucc.asn.au