]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve port of struct timespec to MS-Windows.
authorEli Zaretskii <eliz@gnu.org>
Sun, 24 Jun 2012 17:21:20 +0000 (20:21 +0300)
committerEli Zaretskii <eliz@gnu.org>
Sun, 24 Jun 2012 17:21:20 +0000 (20:21 +0300)
 lib/makefile.w32-in ($(BLD)/dtotimespec.$(O)):
 ($(BLD)/timespec-add.$(O)):
 ($(BLD)/timespec-sub.$(O)): Don't depend on
 $(EMACS_ROOT)/nt/inc/sys/time.h.
 lib/stat-time.h:
 lib/timespec.h:
 lib/utimens.h: Revert last change.
 src/makefile.w32-in (TIMESPEC_H): Remove nt/inc/sys/time.h.
 (SYSTIME_H): Add nt/inc/sys/time.h.
 src/systime.h [WINDOWSNT]: Include sys/time.h.
 src/s/ms-w32.h (struct timespec): Definition moved from
 nt/inc/sys/time.h.  Suggested by Paul Eggert <eggert@cs.ucla.edu>.
 nt/inc/sys/time.h (struct timespec): Don't define it here, it is
 now defined in src/s/ms-w32.h.

Fixes: debbugs:9000
ChangeLog
lib/makefile.w32-in
lib/stat-time.h
lib/timespec.h
lib/utimens.h
nt/ChangeLog
nt/inc/sys/time.h
src/ChangeLog
src/makefile.w32-in
src/s/ms-w32.h
src/systime.h

index f5ebfd9e65046bf16afc276a850fa7dec74ee5a2..1d3aefc99489f3f91fe009754a45fddc480c3377 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2012-06-24  Eli Zaretskii  <eliz@gnu.org>
+
+       * lib/makefile.w32-in ($(BLD)/dtotimespec.$(O)):
+       ($(BLD)/timespec-add.$(O)):
+       ($(BLD)/timespec-sub.$(O)): Don't depend on
+       $(EMACS_ROOT)/nt/inc/sys/time.h.
+
+       * lib/stat-time.h:
+       * lib/timespec.h:
+       * lib/utimens.h: Revert last change.
+
 2012-06-23  Paul Eggert  <eggert@cs.ucla.edu>
 
        Merge from gnulib.
index 35745f647b2a1038eb823ee5ea0327c2d10ad765..b7ce6dd3b0114529714cefbeda6c5cf4503dda79 100644 (file)
@@ -77,7 +77,6 @@ $(BLD)/dtotimespec.$(O) : \
        $(SRC)/dtotimespec.c \
        $(SRC)/intprops.h \
        $(SRC)/timespec.h \
-       $(EMACS_ROOT)/nt/inc/sys/time.h \
        $(EMACS_ROOT)/nt/inc/sys/stat.h \
        $(EMACS_ROOT)/src/s/ms-w32.h \
        $(EMACS_ROOT)/src/config.h
@@ -126,7 +125,6 @@ $(BLD)/timespec-add.$(O) : \
        $(SRC)/timespec-add.c \
        $(SRC)/intprops.h \
        $(SRC)/timespec.h \
-       $(EMACS_ROOT)/nt/inc/sys/time.h \
        $(EMACS_ROOT)/nt/inc/sys/stat.h \
        $(EMACS_ROOT)/src/s/ms-w32.h \
        $(EMACS_ROOT)/src/config.h
@@ -135,7 +133,6 @@ $(BLD)/timespec-sub.$(O) : \
        $(SRC)/timespec-sub.c \
        $(SRC)/intprops.h \
        $(SRC)/timespec.h \
-       $(EMACS_ROOT)/nt/inc/sys/time.h \
        $(EMACS_ROOT)/nt/inc/sys/stat.h \
        $(EMACS_ROOT)/src/s/ms-w32.h \
        $(EMACS_ROOT)/src/config.h
index 03d49977945f76d254ae55a199f5bc7115c729dd..30c2acdab63637b73c590bfb91e06502839bcf94 100644 (file)
@@ -22,7 +22,6 @@
 
 #include <sys/stat.h>
 #include <time.h>
-#include <sys/time.h>
 
 /* STAT_TIMESPEC (ST, ST_XTIM) is the ST_XTIM member for *ST of type
    struct timespec, if available.  If not, then STAT_TIMESPEC_NS (ST,
index 51b85d050daf534fd5acd542c6d6542a6ab6e13f..388ddb83a76120814003276f18966a4f7a904faf 100644 (file)
@@ -20,7 +20,6 @@
 # define TIMESPEC_H
 
 # include <time.h>
-# include <sys/time.h>
 
 /* Return negative, zero, positive if A < B, A == B, A > B, respectively.
 
index dfcbae1909d81c8fa198b592c14c4726bead823d..8c47cf93f887dc05a2e84eb3349d61d91da22177 100644 (file)
@@ -1,5 +1,4 @@
 #include <time.h>
-#include <sys/time.h>
 int fdutimens (int, char const *, struct timespec const [2]);
 int utimens (char const *, struct timespec const [2]);
 int lutimens (char const *, struct timespec const [2]);
index 11109da92f2be57191a933c4cd7f042f0ab5d196..7c2ebd0293693076e512feda576da48954bbc042 100644 (file)
@@ -1,3 +1,8 @@
+2012-06-24  Eli Zaretskii  <eliz@gnu.org>
+
+       * inc/sys/time.h (struct timespec): Don't define it here, it is
+       now defined in src/s/ms-w32.h.
+
 2012-06-23  Eli Zaretskii  <eliz@gnu.org>
 
        Fix the MS-Windows build broken by 2012-06-22T21:17:42Z!eggert@cs.ucla.edu.
index 583b966b760a2bfe6f73e4d09fc2332746740115..db54c90cf1f3bf7f5cc73adbe2e37dd02bbaa110 100644 (file)
@@ -17,12 +17,6 @@ struct timezone
   int          tz_dsttime;     /* type of dst correction */
 };
 
-struct timespec
-{
-  time_t       tv_sec;         /* seconds */
-  long int     tv_nsec;        /* nanoseconds */
-};
-
 void gettimeofday (struct timeval *, struct timezone *);
 
 #endif /* SYS_TIME_H_INCLUDED */
index a302db4fae6c6f3b7b9a05a391da1d57dfb086e0..3f799b9d377873486f4bd329f606cbe12d05c3f0 100644 (file)
@@ -1,3 +1,13 @@
+2012-06-24  Eli Zaretskii  <eliz@gnu.org>
+
+       * makefile.w32-in (TIMESPEC_H): Remove nt/inc/sys/time.h.
+       (SYSTIME_H): Add nt/inc/sys/time.h.
+
+       * systime.h [WINDOWSNT]: Include sys/time.h.
+
+       * s/ms-w32.h (struct timespec): Definition moved from
+       nt/inc/sys/time.h.  Suggested by Paul Eggert <eggert@cs.ucla.edu>.
+
 2012-06-24  Paul Eggert  <eggert@cs.ucla.edu>
 
        Fix bug when time_t is unsigned and as wide as intmax_t (Bug#9000).
index 963d9329e49b7c23d8d6113007955c47ba9c2a30..ef20356fdeb3f003f25fcf3ce9f21fa45cf309f7 100644 (file)
@@ -390,10 +390,10 @@ EMACS_ROOT = ..
 GNU_LIB = $(EMACS_ROOT)/lib
 NT_INC = $(EMACS_ROOT)/nt/inc
 
-TIMESPEC_H     = $(GNU_LIB)/timespec.h \
-                $(NT_INC)/sys/time.h
+TIMESPEC_H     = $(GNU_LIB)/timespec.h
 SYSTIME_H      = $(SRC)/systime.h \
-                $(TIMESPEC_H)
+                $(TIMESPEC_H) \
+                $(NT_INC)/sys/time.h
 ATIMER_H       = $(SRC)/atimer.h \
                 $(SYSTIME_H)
 BLOCKINPUT_H   = $(SRC)/blockinput.h \
index a26530bab64811420fece610b417106485110293..20603562afa5777c973655335f6adcefadbb4052 100644 (file)
@@ -296,6 +296,15 @@ typedef int pid_t;
 #define utime    _utime
 #endif
 
+/* 'struct timespec' is used by time-related functions in lib/ and
+   elsewhere, but we don't use lib/time.h where the structure is
+   defined.  */
+struct timespec
+{
+  time_t       tv_sec;         /* seconds */
+  long int     tv_nsec;        /* nanoseconds */
+};
+
 /* This is hacky, but is necessary to avoid warnings about macro
    redefinitions using the SDK compilers.  */
 #ifndef __STDC__
index dd0d77c827d9f34d0e19fa6bb77e3b6bb461657b..0f91551239e4a1c43349436701c64a3b3e4e0e83 100644 (file)
@@ -38,6 +38,10 @@ typedef unsigned long Time;
 #endif
 #endif
 #endif
+
+#ifdef WINDOWSNT
+#include <sys/time.h>  /* for 'struct timeval' */
+#endif
 \f
 /* The type to use to represent temporal intervals.  It can be passed
    as the timeout argument to the pselect system call.  */