Mercurial > hg > xemacs-beta
comparison src/systime.h @ 412:697ef44129c6 r21-2-14
Import from CVS: tag r21-2-14
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:20:41 +0200 |
parents | de805c49cfc1 |
children |
comparison
equal
deleted
inserted
replaced
411:12e008d41344 | 412:697ef44129c6 |
---|---|
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 Boston, MA 02111-1307, USA. */ | 19 Boston, MA 02111-1307, USA. */ |
20 | 20 |
21 /* Synched up with: FSF 19.30. */ | 21 /* Synched up with: FSF 19.30. */ |
22 | 22 |
23 #ifndef INCLUDED_systime_h_ | 23 #ifndef _XEMACS_SYSTIME_H_ |
24 #define INCLUDED_systime_h_ | 24 #define _XEMACS_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 #ifdef WIN32_NATIVE | 44 #if defined(WINDOWSNT) && defined(HAVE_X_WINDOWS) |
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 | |
56 /* Provides gettimeofday etc */ | 45 /* Provides gettimeofday etc */ |
57 #include <X11/Xw32defs.h> | 46 #include <X11/Xw32defs.h> |
58 #include <X11/Xos.h> | 47 #include <X11/Xos.h> |
59 #else | 48 #endif |
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 */ | |
65 | 49 |
66 #ifdef HAVE_UTIME_H | 50 #ifdef HAVE_UTIME_H |
67 # include <utime.h> | 51 # include <utime.h> |
68 #endif | 52 #endif |
69 | 53 |
70 #if defined(HAVE_TZNAME) && !defined(WIN32_NATIVE) && !defined(CYGWIN) | 54 #ifdef HAVE_TZNAME |
71 #ifndef tzname /* For SGI. */ | 55 #ifndef tzname /* For SGI. */ |
72 extern char *tzname[]; /* RS6000 and others want it this way. */ | 56 extern char *tzname[]; /* RS6000 and others want it this way. */ |
73 #endif | 57 #endif |
74 #endif | 58 #endif |
75 | 59 |
161 #define EMACS_USECS(time) ((time).tv_usec + 0) | 145 #define EMACS_USECS(time) ((time).tv_usec + 0) |
162 #define EMACS_SET_SECS(time, seconds) ((time).tv_sec = (seconds)) | 146 #define EMACS_SET_SECS(time, seconds) ((time).tv_sec = (seconds)) |
163 #define EMACS_SET_USECS(time, microseconds) ((time).tv_usec = (microseconds)) | 147 #define EMACS_SET_USECS(time, microseconds) ((time).tv_usec = (microseconds)) |
164 | 148 |
165 #if !defined (HAVE_GETTIMEOFDAY) | 149 #if !defined (HAVE_GETTIMEOFDAY) |
166 int gettimeofday (struct timeval *, void *); | 150 struct timezone; |
151 int gettimeofday (struct timeval *, struct timezone *); | |
167 #endif | 152 #endif |
168 | 153 |
169 /* On SVR4, the compiler may complain if given this extra BSD arg. */ | 154 /* On SVR4, the compiler may complain if given this extra BSD arg. */ |
170 #ifdef GETTIMEOFDAY_ONE_ARGUMENT | 155 #ifdef GETTIMEOFDAY_ONE_ARGUMENT |
171 #define EMACS_GETTIMEOFDAY(time) gettimeofday(time) | 156 # ifdef SOLARIS2 |
172 #else | 157 /* Solaris (at least) omits this prototype. IRIX5 has it and chokes if we |
173 #define EMACS_GETTIMEOFDAY(time) gettimeofday(time,0) | 158 declare it here. */ |
174 #endif | 159 int gettimeofday (struct timeval *); |
175 | 160 # endif |
176 /* According to the Xt sources, some NTP daemons on some systems may | 161 /* According to the Xt sources, some NTP daemons on some systems may |
177 return non-normalized values. */ | 162 return non-normalized values. */ |
178 #define EMACS_GET_TIME(time) \ | 163 #define EMACS_GET_TIME(time) \ |
179 do { \ | 164 do { \ |
180 EMACS_GETTIMEOFDAY (&(time)); \ | 165 gettimeofday (&(time)); \ |
181 EMACS_NORMALIZE_TIME (time); \ | 166 EMACS_NORMALIZE_TIME (time); \ |
182 } while (0) | 167 } 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 */ | |
183 | 181 |
184 #define EMACS_NORMALIZE_TIME(time) \ | 182 #define EMACS_NORMALIZE_TIME(time) \ |
185 do { \ | 183 do { \ |
186 while ((time).tv_usec >= 1000000) \ | 184 while ((time).tv_usec >= 1000000) \ |
187 { \ | 185 { \ |
231 int set_file_times (char *filename, EMACS_TIME atime, EMACS_TIME mtime); | 229 int set_file_times (char *filename, EMACS_TIME atime, EMACS_TIME mtime); |
232 | 230 |
233 void get_process_times (double *user_time, double *system_time, | 231 void get_process_times (double *user_time, double *system_time, |
234 double *real_time); | 232 double *real_time); |
235 | 233 |
236 #if defined(WIN32_NATIVE) || defined(BROKEN_CYGWIN) | 234 #if defined(WINDOWSNT) || defined(BROKEN_CYGWIN) || defined(__MINGW32__) |
237 | 235 |
238 /* setitimer emulation for Win32 (see nt.c) */ | 236 /* setitimer emulation for Win32 (see nt.c) */ |
239 | 237 |
240 struct itimerval | 238 struct itimerval |
241 { | 239 { |
247 struct itimerval* itold); | 245 struct itimerval* itold); |
248 | 246 |
249 #define ITIMER_REAL 1 | 247 #define ITIMER_REAL 1 |
250 #define ITIMER_PROF 2 | 248 #define ITIMER_PROF 2 |
251 | 249 |
252 #endif /* WIN32_NATIVE */ | 250 #endif /* WINDOWSNT */ |
253 | 251 |
254 #endif /* INCLUDED_systime_h_ */ | 252 #endif /* _XEMACS_SYSTIME_H_ */ |