comparison src/systime.h @ 398:74fd4e045ea6 r21-2-29

Import from CVS: tag r21-2-29
author cvs
date Mon, 13 Aug 2007 11:13:30 +0200
parents 6719134a07c2
children de805c49cfc1
comparison
equal deleted inserted replaced
397:f4aeb21a5bad 398:74fd4e045ea6
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 _XEMACS_SYSTIME_H_ 23 #ifndef INCLUDED_systime_h_
24 #define _XEMACS_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
49 49
50 #ifdef HAVE_UTIME_H 50 #ifdef HAVE_UTIME_H
51 # include <utime.h> 51 # include <utime.h>
52 #endif 52 #endif
53 53
54 #ifdef HAVE_TZNAME 54 #if defined(HAVE_TZNAME) && !defined(WINDOWSNT) && !defined(__CYGWIN32__)
55 #ifndef tzname /* For SGI. */ 55 #ifndef tzname /* For SGI. */
56 extern char *tzname[]; /* RS6000 and others want it this way. */ 56 extern char *tzname[]; /* RS6000 and others want it this way. */
57 #endif 57 #endif
58 #endif 58 #endif
59 59
145 #define EMACS_USECS(time) ((time).tv_usec + 0) 145 #define EMACS_USECS(time) ((time).tv_usec + 0)
146 #define EMACS_SET_SECS(time, seconds) ((time).tv_sec = (seconds)) 146 #define EMACS_SET_SECS(time, seconds) ((time).tv_sec = (seconds))
147 #define EMACS_SET_USECS(time, microseconds) ((time).tv_usec = (microseconds)) 147 #define EMACS_SET_USECS(time, microseconds) ((time).tv_usec = (microseconds))
148 148
149 #if !defined (HAVE_GETTIMEOFDAY) 149 #if !defined (HAVE_GETTIMEOFDAY)
150 struct timezone; 150 int gettimeofday (struct timeval *, void *);
151 int gettimeofday (struct timeval *, struct timezone *);
152 #endif 151 #endif
153 152
154 /* On SVR4, the compiler may complain if given this extra BSD arg. */ 153 /* On SVR4, the compiler may complain if given this extra BSD arg. */
155 #ifdef GETTIMEOFDAY_ONE_ARGUMENT 154 #ifdef GETTIMEOFDAY_ONE_ARGUMENT
156 # ifdef SOLARIS2 155 #define EMACS_GETTIMEOFDAY(time) gettimeofday(time)
157 /* Solaris (at least) omits this prototype. IRIX5 has it and chokes if we 156 #else
158 declare it here. */ 157 #define EMACS_GETTIMEOFDAY(time) gettimeofday(time,0)
159 int gettimeofday (struct timeval *); 158 #endif
160 # endif 159
161 /* According to the Xt sources, some NTP daemons on some systems may 160 /* According to the Xt sources, some NTP daemons on some systems may
162 return non-normalized values. */ 161 return non-normalized values. */
163 #define EMACS_GET_TIME(time) \ 162 #define EMACS_GET_TIME(time) \
164 do { \ 163 do { \
165 gettimeofday (&(time)); \ 164 EMACS_GETTIMEOFDAY (&(time)); \
166 EMACS_NORMALIZE_TIME (time); \ 165 EMACS_NORMALIZE_TIME (time); \
167 } while (0) 166 } 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 167
182 #define EMACS_NORMALIZE_TIME(time) \ 168 #define EMACS_NORMALIZE_TIME(time) \
183 do { \ 169 do { \
184 while ((time).tv_usec >= 1000000) \ 170 while ((time).tv_usec >= 1000000) \
185 { \ 171 { \
229 int set_file_times (char *filename, EMACS_TIME atime, EMACS_TIME mtime); 215 int set_file_times (char *filename, EMACS_TIME atime, EMACS_TIME mtime);
230 216
231 void get_process_times (double *user_time, double *system_time, 217 void get_process_times (double *user_time, double *system_time,
232 double *real_time); 218 double *real_time);
233 219
234 #if defined(WINDOWSNT) || defined(BROKEN_CYGWIN) 220 #if defined(WINDOWSNT) || defined(BROKEN_CYGWIN) || defined(__MINGW32__)
235 221
236 /* setitimer emulation for Win32 (see nt.c) */ 222 /* setitimer emulation for Win32 (see nt.c) */
237 223
238 struct itimerval 224 struct itimerval
239 { 225 {
247 #define ITIMER_REAL 1 233 #define ITIMER_REAL 1
248 #define ITIMER_PROF 2 234 #define ITIMER_PROF 2
249 235
250 #endif /* WINDOWSNT */ 236 #endif /* WINDOWSNT */
251 237
252 #endif /* _XEMACS_SYSTIME_H_ */ 238 #endif /* INCLUDED_systime_h_ */