Mercurial > hg > xemacs-beta
comparison src/systime.h @ 442:abe6d1db359e r21-2-36
Import from CVS: tag r21-2-36
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:35:02 +0200 |
parents | 8de8e3f6228a |
children | 223736d75acb |
comparison
equal
deleted
inserted
replaced
441:72a7cfa4a488 | 442:abe6d1db359e |
---|---|
22 | 22 |
23 #ifndef INCLUDED_systime_h_ | 23 #ifndef INCLUDED_systime_h_ |
24 #define INCLUDED_systime_h_ | 24 #define INCLUDED_systime_h_ |
25 | 25 |
26 #ifdef TIME_WITH_SYS_TIME | 26 #ifdef TIME_WITH_SYS_TIME |
27 #include <sys/time.h> | 27 # include <sys/time.h> |
28 #include <time.h> | 28 # include <time.h> |
29 #else | 29 #else |
30 #ifdef HAVE_SYS_TIME_H | 30 # ifdef HAVE_SYS_TIME_H |
31 #include <sys/time.h> | 31 # include <sys/time.h> |
32 #else | 32 # else |
33 #include <time.h> | 33 # include <time.h> |
34 #endif | 34 # endif |
35 #endif | 35 #endif |
36 | 36 |
37 /* select() is supposed to be (Unix98) defined in sys/time.h, | 37 /* select() is supposed to be (Unix98) defined in sys/time.h, |
38 but FreeBSD and Irix 5 put it in unistd.h instead. | 38 but FreeBSD and Irix 5 put it in unistd.h instead. |
39 If we have it, including it can't hurt. */ | 39 If we have it, including it can't hurt. */ |
40 #ifdef HAVE_UNISTD_H | 40 #ifdef HAVE_UNISTD_H |
41 #include <unistd.h> | 41 #include <unistd.h> |
42 #endif | 42 #endif |
43 | 43 |
44 #if defined(WINDOWSNT) && defined(HAVE_X_WINDOWS) | 44 #ifdef WIN32_NATIVE |
45 | |
46 /* This defines struct timeval */ | |
47 #include <winsock.h> | |
48 | |
49 struct timezone | |
50 { | |
51 int tz_minuteswest; /* minutes west of Greenwich */ | |
52 int tz_dsttime; /* type of dst correction */ | |
53 }; | |
54 | |
55 #ifdef HAVE_X_WINDOWS | |
45 /* Provides gettimeofday etc */ | 56 /* Provides gettimeofday etc */ |
46 #include <X11/Xw32defs.h> | 57 #include <X11/Xw32defs.h> |
47 #include <X11/Xos.h> | 58 #include <X11/Xos.h> |
48 #endif | 59 #else |
60 /* X11R6 on NT provides the single parameter version of this command */ | |
61 void gettimeofday (struct timeval *, struct timezone *); | |
62 #endif /* HAVE_X_WINDOWS */ | |
63 | |
64 #endif /* WIN32_NATIVE */ | |
49 | 65 |
50 #ifdef HAVE_UTIME_H | 66 #ifdef HAVE_UTIME_H |
51 # include <utime.h> | 67 # include <utime.h> |
52 #endif | 68 #endif |
53 | 69 |
54 #if defined(HAVE_TZNAME) && !defined(WINDOWSNT) && !defined(__CYGWIN32__) | 70 #if defined(HAVE_TZNAME) && !defined(WIN32_NATIVE) && !defined(CYGWIN) |
55 #ifndef tzname /* For SGI. */ | 71 #ifndef tzname /* For SGI. */ |
56 extern char *tzname[]; /* RS6000 and others want it this way. */ | 72 extern char *tzname[]; /* RS6000 and others want it this way. */ |
57 #endif | 73 #endif |
58 #endif | 74 #endif |
59 | 75 |
145 #define EMACS_USECS(time) ((time).tv_usec + 0) | 161 #define EMACS_USECS(time) ((time).tv_usec + 0) |
146 #define EMACS_SET_SECS(time, seconds) ((time).tv_sec = (seconds)) | 162 #define EMACS_SET_SECS(time, seconds) ((time).tv_sec = (seconds)) |
147 #define EMACS_SET_USECS(time, microseconds) ((time).tv_usec = (microseconds)) | 163 #define EMACS_SET_USECS(time, microseconds) ((time).tv_usec = (microseconds)) |
148 | 164 |
149 #if !defined (HAVE_GETTIMEOFDAY) | 165 #if !defined (HAVE_GETTIMEOFDAY) |
150 struct timezone; | 166 int gettimeofday (struct timeval *, void *); |
151 int gettimeofday (struct timeval *, struct timezone *); | |
152 #endif | 167 #endif |
153 | 168 |
154 /* On SVR4, the compiler may complain if given this extra BSD arg. */ | 169 /* On SVR4, the compiler may complain if given this extra BSD arg. */ |
155 #ifdef GETTIMEOFDAY_ONE_ARGUMENT | 170 #ifdef GETTIMEOFDAY_ONE_ARGUMENT |
156 # ifdef SOLARIS2 | 171 #define EMACS_GETTIMEOFDAY(time) gettimeofday(time) |
157 /* Solaris (at least) omits this prototype. IRIX5 has it and chokes if we | 172 #else |
158 declare it here. */ | 173 #define EMACS_GETTIMEOFDAY(time) gettimeofday(time,0) |
159 int gettimeofday (struct timeval *); | 174 #endif |
160 # endif | 175 |
161 /* According to the Xt sources, some NTP daemons on some systems may | 176 /* According to the Xt sources, some NTP daemons on some systems may |
162 return non-normalized values. */ | 177 return non-normalized values. */ |
163 #define EMACS_GET_TIME(time) \ | 178 #define EMACS_GET_TIME(time) \ |
164 do { \ | 179 do { \ |
165 gettimeofday (&(time)); \ | 180 EMACS_GETTIMEOFDAY (&(time)); \ |
166 EMACS_NORMALIZE_TIME (time); \ | 181 EMACS_NORMALIZE_TIME (time); \ |
167 } while (0) | 182 } while (0) |
168 #else /* not GETTIMEOFDAY_ONE_ARGUMENT */ | |
169 # ifdef SOLARIS2 | |
170 /* Solaris doesn't provide any prototype of this unless a bunch of | |
171 crap we don't define are defined. */ | |
172 int gettimeofday (struct timeval *, void *dummy); | |
173 # endif | |
174 #define EMACS_GET_TIME(time) \ | |
175 do { \ | |
176 struct timezone dummy; \ | |
177 gettimeofday (&(time), &dummy); \ | |
178 EMACS_NORMALIZE_TIME (time); \ | |
179 } while (0) | |
180 #endif /* not GETTIMEOFDAY_ONE_ARGUMENT */ | |
181 | 183 |
182 #define EMACS_NORMALIZE_TIME(time) \ | 184 #define EMACS_NORMALIZE_TIME(time) \ |
183 do { \ | 185 do { \ |
184 while ((time).tv_usec >= 1000000) \ | 186 while ((time).tv_usec >= 1000000) \ |
185 { \ | 187 { \ |
229 int set_file_times (char *filename, EMACS_TIME atime, EMACS_TIME mtime); | 231 int set_file_times (char *filename, EMACS_TIME atime, EMACS_TIME mtime); |
230 | 232 |
231 void get_process_times (double *user_time, double *system_time, | 233 void get_process_times (double *user_time, double *system_time, |
232 double *real_time); | 234 double *real_time); |
233 | 235 |
234 #if defined(WINDOWSNT) || defined(BROKEN_CYGWIN) || defined(__MINGW32__) | 236 #if defined(WIN32_NATIVE) || defined(BROKEN_CYGWIN) |
235 | 237 |
236 /* setitimer emulation for Win32 (see nt.c) */ | 238 /* setitimer emulation for Win32 (see nt.c) */ |
237 | 239 |
238 struct itimerval | 240 struct itimerval |
239 { | 241 { |
245 struct itimerval* itold); | 247 struct itimerval* itold); |
246 | 248 |
247 #define ITIMER_REAL 1 | 249 #define ITIMER_REAL 1 |
248 #define ITIMER_PROF 2 | 250 #define ITIMER_PROF 2 |
249 | 251 |
250 #endif /* WINDOWSNT */ | 252 #endif /* WIN32_NATIVE */ |
251 | 253 |
252 #endif /* INCLUDED_systime_h_ */ | 254 #endif /* INCLUDED_systime_h_ */ |