1 /** 2 * D header file for POSIX. 3 * 4 * Copyright: Public Domain 5 * License: Public Domain 6 * Authors: Sean Kelly 7 * Standards: The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition 8 */ 9 module tango.stdc.posix.sys.time; 10 11 private import tango.stdc.posix.config; 12 public import tango.stdc.posix.sys.types; // for time_t, suseconds_t 13 public import tango.stdc.posix.sys.select; // for fd_set, FD_CLR() FD_ISSET() FD_SET() FD_ZERO() FD_SETSIZE 14 15 extern (C): 16 17 // 18 // XOpen (XSI) 19 // 20 /* 21 struct timeval 22 { 23 time_t tv_sec; 24 suseconds_t tv_usec; 25 } 26 27 struct itimerval 28 { 29 timeval it_interval; 30 timeval it_value; 31 } 32 33 ITIMER_REAL 34 ITIMER_VIRTUAL 35 ITIMER_PROF 36 37 int getitimer(int, itimerval*); 38 int gettimeofday(timeval*, void*); 39 int select(int, fd_set*, fd_set*, fd_set*, timeval*); 40 int setitimer(int, in itimerval*, itimerval*); 41 int utimes(in char*, in timeval[2]); // LEGACY 42 */ 43 44 version( linux ) 45 { 46 struct timeval 47 { 48 time_t tv_sec; 49 suseconds_t tv_usec; 50 } 51 52 struct itimerval 53 { 54 timeval it_interval; 55 timeval it_value; 56 } 57 58 const ITIMER_REAL = 0; 59 const ITIMER_VIRTUAL = 1; 60 const ITIMER_PROF = 2; 61 62 int getitimer(int, itimerval*); 63 int gettimeofday(timeval*, void*); 64 int select(int, fd_set*, fd_set*, fd_set*, timeval*); 65 int setitimer(int, in itimerval*, itimerval*); 66 int utimes(in char*, in timeval[2]); // LEGACY 67 } 68 else version( darwin ) 69 { 70 struct timeval 71 { 72 time_t tv_sec; 73 suseconds_t tv_usec; 74 } 75 76 struct itimerval 77 { 78 timeval it_interval; 79 timeval it_value; 80 } 81 82 // non-standard 83 struct timezone_t 84 { 85 int tz_minuteswest; 86 int tz_dsttime; 87 } 88 89 int getitimer(int, itimerval*); 90 int gettimeofday(timeval*, timezone_t*); // timezone_t* is normally void* 91 int select(int, fd_set*, fd_set*, fd_set*, timeval*); 92 int setitimer(int, in itimerval*, itimerval*); 93 int utimes(in char*, in timeval[2]); 94 } 95 else version( FreeBSD ) 96 { 97 struct timeval 98 { 99 time_t tv_sec; 100 suseconds_t tv_usec; 101 } 102 103 struct itimerval 104 { 105 timeval it_interval; 106 timeval it_value; 107 } 108 109 // non-standard 110 struct timezone_t 111 { 112 int tz_minuteswest; 113 int tz_dsttime; 114 } 115 116 int getitimer(int, itimerval*); 117 int gettimeofday(timeval*, timezone_t*); // timezone_t* is normally void* 118 int select(int, fd_set*, fd_set*, fd_set*, timeval*); 119 int setitimer(int, in itimerval*, itimerval*); 120 int utimes(in char*, in timeval[2]); 121 } 122 else version( solaris ) 123 { 124 struct timeval 125 { 126 time_t tv_sec; 127 suseconds_t tv_usec; 128 } 129 130 struct itimerval 131 { 132 timeval it_interval; 133 timeval it_value; 134 } 135 136 // non-standard 137 struct timezone_t 138 { 139 int tz_minuteswest; 140 int tz_dsttime; 141 } 142 143 int getitimer(int, itimerval*); 144 int gettimeofday(timeval*, timezone_t*); // timezone_t* is normally void* 145 int select(int, fd_set*, fd_set*, fd_set*, timeval*); 146 int setitimer(int, in itimerval*, itimerval*); 147 int utimes(in char*, in timeval*); 148 }