132
|
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, itimerval*, itimerval*);
|
|
41 int utimes(char*, 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, itimerval*, itimerval*);
|
|
66 int utimes(char*, 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, itimerval*, itimerval*);
|
|
93 int utimes(char*, timeval*);
|
|
94 }
|