bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#9000: patch for higher-resolution time stamps


From: Paul Eggert
Subject: bug#9000: patch for higher-resolution time stamps
Date: Sat, 23 Jun 2012 11:55:37 -0700
User-agent: Mozilla/5.0 (X11; Linux i686; rv:13.0) Gecko/20120615 Thunderbird/13.0.1

On 06/23/2012 03:48 AM, Eli Zaretskii wrote:
>  . do not assume that 'struct timespec' is defined on time.h, or on
>    any other MS-Windows system header
>  . do not use gnulib's time.h (as that requires Sed to edit time.in.h)

OK, thanks, here's a proposed patch to do that.
I'd rather leave gnulib alone, since struct timeval has
nothing to do with sys/time.h in POSIX.

=== modified file 'ChangeLog'
--- ChangeLog   2012-06-23 17:25:56 +0000
+++ ChangeLog   2012-06-23 18:51:45 +0000
@@ -1,5 +1,10 @@
 2012-06-23  Paul Eggert  <eggert@cs.ucla.edu>
 
+       Improve port of struct timespec to MS-Windows.
+       * lib/stat-time.h, lib/timespec.h, lib/utimens.h:
+       Do not include sys/time.h.  This reverts the most recent change,
+       so that these files stay in step with gnulib.
+
        Merge from gnulib.
        * m4/getopt.m4: Copy new version from gnulib, incorporating:
        getopt-gnu: Handle suboptimal getopt_long's abbreviation handling.

=== modified file 'lib/stat-time.h'
--- lib/stat-time.h     2012-06-23 10:22:59 +0000
+++ lib/stat-time.h     2012-06-23 18:51:45 +0000
@@ -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,

=== modified file 'lib/timespec.h'
--- lib/timespec.h      2012-06-23 10:22:59 +0000
+++ lib/timespec.h      2012-06-23 18:51:45 +0000
@@ -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.
 

=== modified file 'lib/utimens.h'
--- lib/utimens.h       2012-06-23 10:22:59 +0000
+++ lib/utimens.h       2012-06-23 18:51:45 +0000
@@ -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]);

=== modified file 'nt/ChangeLog'
--- nt/ChangeLog        2012-06-23 10:22:59 +0000
+++ nt/ChangeLog        2012-06-23 18:51:45 +0000
@@ -1,3 +1,8 @@
+2012-06-23  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Improve port of struct timespec to MS-Windows.
+       * inc/sys/time.h (struct timespec): Remove, undoing previous change.
+
 2012-06-23  Eli Zaretskii  <eliz@gnu.org>
 
        Fix the MS-Windows build broken by revno 108687.

=== modified file 'nt/inc/sys/time.h'
--- nt/inc/sys/time.h   2012-06-23 10:22:59 +0000
+++ nt/inc/sys/time.h   2012-06-23 18:51:45 +0000
@@ -17,15 +17,8 @@
   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 */
 
 /* end of sys/time.h */
-

=== modified file 'src/ChangeLog'
--- src/ChangeLog       2012-06-23 16:56:47 +0000
+++ src/ChangeLog       2012-06-23 18:51:45 +0000
@@ -1,3 +1,8 @@
+2012-06-23  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Improve port of struct timespec to MS-Windows.
+       * s/ms-w32.h (struct timespec) [_MSC_VER]: New decl.
+
 2012-06-23  Juanma Barranquero  <lekktu@gmail.com>
 
        * w32.c (ltime): Add return type and declare static.

=== modified file 'src/s/ms-w32.h'
--- src/s/ms-w32.h      2012-06-23 10:22:59 +0000
+++ src/s/ms-w32.h      2012-06-23 18:54:35 +0000
@@ -296,6 +296,15 @@
 #define utime    _utime
 #endif
 
+#ifdef _MSC_VER
+/* MSVC does not define struct timespec in <time.h>.  */
+struct timespec
+{
+  time_t       tv_sec;         /* seconds */
+  long int     tv_nsec;        /* nanoseconds */
+};
+#endif
+
 /* This is hacky, but is necessary to avoid warnings about macro
    redefinitions using the SDK compilers.  */
 #ifndef __STDC__





reply via email to

[Prev in Thread] Current Thread [Next in Thread]