diff 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
line wrap: on
line diff
--- a/src/systime.h	Mon Aug 13 11:19:22 2007 +0200
+++ b/src/systime.h	Mon Aug 13 11:20:41 2007 +0200
@@ -20,18 +20,18 @@
 
 /* Synched up with: FSF 19.30. */
 
-#ifndef INCLUDED_systime_h_
-#define INCLUDED_systime_h_
+#ifndef _XEMACS_SYSTIME_H_
+#define _XEMACS_SYSTIME_H_
 
 #ifdef TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
+#include <sys/time.h>
+#include <time.h>
 #else
-# ifdef HAVE_SYS_TIME_H
-#  include <sys/time.h>
-# else
-#  include <time.h>
-# endif
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#else
+#include <time.h>
+#endif
 #endif
 
 /* select() is supposed to be (Unix98) defined in sys/time.h,
@@ -41,33 +41,17 @@
 #include <unistd.h>
 #endif
 
-#ifdef WIN32_NATIVE
-
-/* This defines struct timeval */
-#include <winsock.h>
-
-struct timezone 
-  {
-    int	tz_minuteswest;	/* minutes west of Greenwich */
-    int	tz_dsttime;	/* type of dst correction */
-  };
-
-#ifdef HAVE_X_WINDOWS
+#if defined(WINDOWSNT) && defined(HAVE_X_WINDOWS)
 /* Provides gettimeofday etc */
 #include <X11/Xw32defs.h>
 #include <X11/Xos.h>
-#else
-/* X11R6 on NT provides the single parameter version of this command */
-void gettimeofday (struct timeval *, struct timezone *);
-#endif /* HAVE_X_WINDOWS */
-
-#endif /* WIN32_NATIVE */
+#endif
 
 #ifdef HAVE_UTIME_H
 # include <utime.h>
 #endif
 
-#if defined(HAVE_TZNAME) && !defined(WIN32_NATIVE) && !defined(CYGWIN)
+#ifdef HAVE_TZNAME
 #ifndef tzname		/* For SGI.  */
 extern char *tzname[];	/* RS6000 and others want it this way.  */
 #endif
@@ -163,23 +147,37 @@
 #define EMACS_SET_USECS(time, microseconds) ((time).tv_usec = (microseconds))
 
 #if !defined (HAVE_GETTIMEOFDAY)
-int gettimeofday (struct timeval *, void *);
+struct timezone;
+int gettimeofday (struct timeval *, struct timezone *);
 #endif
 
 /* On SVR4, the compiler may complain if given this extra BSD arg.  */
 #ifdef GETTIMEOFDAY_ONE_ARGUMENT
-#define EMACS_GETTIMEOFDAY(time) gettimeofday(time)
-#else
-#define EMACS_GETTIMEOFDAY(time) gettimeofday(time,0)
-#endif
-
+# ifdef SOLARIS2
+/* Solaris (at least) omits this prototype.  IRIX5 has it and chokes if we
+   declare it here. */
+int gettimeofday (struct timeval *);
+# endif
 /* According to the Xt sources, some NTP daemons on some systems may
    return non-normalized values. */
 #define EMACS_GET_TIME(time)					\
 do {								\
-  EMACS_GETTIMEOFDAY (&(time));					\
+  gettimeofday (&(time));					\
   EMACS_NORMALIZE_TIME (time);					\
 } while (0)
+#else /* not GETTIMEOFDAY_ONE_ARGUMENT */
+# ifdef SOLARIS2
+/* Solaris doesn't provide any prototype of this unless a bunch of
+   crap we don't define are defined. */
+int gettimeofday (struct timeval *, void *dummy);
+# endif
+#define EMACS_GET_TIME(time)					\
+do {								\
+  struct timezone dummy;					\
+  gettimeofday (&(time), &dummy);				\
+  EMACS_NORMALIZE_TIME (time);					\
+} while (0)
+#endif /* not GETTIMEOFDAY_ONE_ARGUMENT */
 
 #define EMACS_NORMALIZE_TIME(time)				\
 do {								\
@@ -233,7 +231,7 @@
 void get_process_times (double *user_time, double *system_time,
 			double *real_time);
 
-#if defined(WIN32_NATIVE) || defined(BROKEN_CYGWIN)
+#if defined(WINDOWSNT) || defined(BROKEN_CYGWIN) || defined(__MINGW32__)
 
 /* setitimer emulation for Win32 (see nt.c) */
 
@@ -249,6 +247,6 @@
 #define ITIMER_REAL 1
 #define ITIMER_PROF 2
 
-#endif /* WIN32_NATIVE */
+#endif /* WINDOWSNT */
 
-#endif /* INCLUDED_systime_h_ */
+#endif /* _XEMACS_SYSTIME_H_ */