Watt-32 tcp/ip  2.2 dev-rel.10
wtime.h
Go to the documentation of this file.
1 
6 #ifndef __SYS_WTIME_H
7 #define __SYS_WTIME_H
8 
9 /*
10  * The naming <sys/wtime.h> is required for those compilers that
11  * have <sys/time.h> in the usual place but doesn't define
12  * the following.
13  */
14 
15 #include <time.h>
16 
17 #ifdef __BORLANDC__
18 #undef timezone /* a macro in bcc 5+ */
19 #endif
20 
21 #ifndef __SYS_W32API_H
22 #include <sys/w32api.h>
23 #endif
24 
25 #ifndef __SYS_CDEFS_H
26 #include <sys/cdefs.h>
27 #endif
28 
29 #if defined(__DJGPP__) || defined(__CYGWIN__)
30  #include <sys/time.h>
31  #include <sys/times.h>
32  #include <sys/types.h>
33 
34 #elif defined(__MINGW32__)
35  #include <sys/time.h>
36 
37 #else
38  struct timeval {
39  long tv_sec;
40  long tv_usec;
41  };
42  #define STRUCT_TIMEVAL_DEFINED
43 #endif
44 
45 #if !defined(__DJGPP__) && !defined(__CYGWIN__)
46  #if !W32_MINGW_VER(3,10)
47  struct timezone { /* Added in MingW 3.1 */
48  int tz_minuteswest;
49  int tz_dsttime;
50  };
51  #endif
52 
53  struct tms {
54  unsigned long tms_utime;
55  unsigned long tms_cstime;
56  unsigned long tms_cutime;
57  unsigned long tms_stime;
58  };
59  #define STRUCT_TIMEZONE_DEFINED
60  #define STRUCT_TMS_DEFINED
61 
62  __BEGIN_DECLS
63 
64  #define ITIMER_REAL 0
65  #define ITIMER_PROF 1
66 
67  struct itimerval {
68  struct timeval it_interval; /* timer interval */
69  struct timeval it_value; /* current value */
70  };
71 
72  W32_FUNC int W32_CALL getitimer (int, struct itimerval *);
73  W32_FUNC int W32_CALL setitimer (int, struct itimerval *, struct itimerval *);
74 
75  #if !W32_MINGW_VER(3,10) /* Added in MingW 3.1 */
76  #define gettimeofday W32_NAMESPACE (gettimeofday)
77  W32_FUNC int W32_CALL gettimeofday (struct timeval *tp, struct timezone *tz);
78  #endif
79 
80  __END_DECLS
81 
82 #endif /* !__DJGPP__ && !__CYGWIN__ */
83 
84 #if !defined(_STRUCT_TIMESPEC) && !defined(_TIMESPEC_DEFINED) && \
85  !defined(_pthread_signal_h) && !defined(__CYGWIN__)
86  #define _STRUCT_TIMESPEC
87  struct timespec {
88  long tv_sec;
89  long tv_nsec;
90  };
91 #endif
92 
93 #ifndef HZ
94 #define HZ 18.2F
95 #endif
96 
97 __BEGIN_DECLS
98 
99 W32_FUNC unsigned long W32_CALL net_times (struct tms *buffer);
100 W32_FUNC int W32_CALL gettimeofday2 (struct timeval *tv, struct timezone *tz);
101 
102 __END_DECLS
103 
104 /*
105  * Operations on timevals.
106  *
107  * NB: timercmp does not work for >= or <=.
108  */
109 #ifndef timerisset
110  #define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
111 
112  #define timercmp(tvp, uvp, cmp) ((tvp)->tv_sec cmp (uvp)->tv_sec || \
113  ((tvp)->tv_sec == (uvp)->tv_sec && \
114  (tvp)->tv_usec cmp (uvp)->tv_usec))
115 
116  #define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
117 #endif
118 
119 #endif /* !__SYS_WTIME_H */
Definition: wtime.h:38
Definition: wtime.h:53
Definition: wtime.h:87
Definition: wtime.h:47