emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 792ffa0: Remove gettimeofday from w32 sources


From: Eli Zaretskii
Subject: [Emacs-diffs] master 792ffa0: Remove gettimeofday from w32 sources
Date: Sun, 14 May 2017 12:04:19 -0400 (EDT)

branch: master
commit 792ffa022380e05d49437e47823cfdf82337a253
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Remove gettimeofday from w32 sources
    
    * lib-src/ntlib.c (gettimeofday):
    * nt/inc/sys/time.h (gettimeofday, struct timezone): Remove unused
    function 'gettimeofday' and all of its supporting code.
---
 lib-src/ntlib.c   | 25 -------------------------
 nt/inc/sys/time.h | 19 -------------------
 src/w32.c         | 27 ---------------------------
 3 files changed, 71 deletions(-)

diff --git a/lib-src/ntlib.c b/lib-src/ntlib.c
index 4bffc61..78ba906 100644
--- a/lib-src/ntlib.c
+++ b/lib-src/ntlib.c
@@ -50,8 +50,6 @@ struct timezone
 };
 #endif
 
-void gettimeofday (struct timeval *, struct timezone *);
-
 #define MAXPATHLEN _MAX_PATH
 
 /* Emulate sleep...we could have done this with a define, but that
@@ -229,29 +227,6 @@ getpass (const char * prompt)
   return NULL;
 }
 
-/* This is needed because lib/gettime.c calls gettimeofday, which MSVC
-   doesn't have.  Copied from w32.c.  */
-void
-gettimeofday (struct timeval *tv, struct timezone *tz)
-{
-  struct _timeb tb;
-  _ftime (&tb);
-
-  tv->tv_sec = tb.time;
-  tv->tv_usec = tb.millitm * 1000L;
-  /* Implementation note: _ftime sometimes doesn't update the dstflag
-     according to the new timezone when the system timezone is
-     changed.  We could fix that by using GetSystemTime and
-     GetTimeZoneInformation, but that doesn't seem necessary, since
-     Emacs always calls gettimeofday with the 2nd argument NULL (see
-     current_emacs_time).  */
-  if (tz)
-    {
-      tz->tz_minuteswest = tb.timezone;        /* minutes west of Greenwich  */
-      tz->tz_dsttime = tb.dstflag;     /* type of dst correction  */
-    }
-}
-
 int
 fchown (int fd, unsigned uid, unsigned gid)
 {
diff --git a/nt/inc/sys/time.h b/nt/inc/sys/time.h
index 88ea32b..de06c11 100644
--- a/nt/inc/sys/time.h
+++ b/nt/inc/sys/time.h
@@ -25,25 +25,6 @@ struct timeval
 #define timerclear(tvp)  (tvp)->tv_sec = (tvp)->tv_usec = 0
 #endif /* _TIMEVAL_DEFINED */
 
-#ifndef _TIMEZONE_DEFINED
-#define _TIMEZONE_DEFINED
-struct timezone
-{
-  int          tz_minuteswest; /* minutes west of Greenwich */
-  int          tz_dsttime;     /* type of dst correction */
-};
-#endif
-
-
-/* This needs to be compatible with Posix signature, in order to pass
-   the configure test for the type of the second argument; see
-   m4/gettimeofday.m4.  We use '__restrict' here, rather than
-   'restrict', for the benefit of the old nt/configure.bat build,
-   which does not force the use of -std= switch to GCC, and that
-   causes compilation errors with 'restrict', which is a C99
-   extension.  */
-int gettimeofday (struct timeval *__restrict, void *__restrict);
-
 #define ITIMER_REAL      0
 #define ITIMER_PROF      1
 
diff --git a/src/w32.c b/src/w32.c
index 878b224..fa3cbe1 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -2978,33 +2978,6 @@ emacs_root_dir (void)
   return root_dir;
 }
 
-#include <sys/timeb.h>
-
-/* Emulate gettimeofday (Ulrich Leodolter, 1/11/95).  */
-int
-gettimeofday (struct timeval *__restrict tv, void *__restrict tzv)
-{
-  struct _timeb tb;
-  _ftime (&tb);
-
-  tv->tv_sec = tb.time;
-  tv->tv_usec = tb.millitm * 1000L;
-  /* Implementation note: _ftime sometimes doesn't update the dstflag
-     according to the new timezone when the system timezone is
-     changed.  We could fix that by using GetSystemTime and
-     GetTimeZoneInformation, but that doesn't seem necessary, since
-     Emacs always calls gettimeofday with the 2nd argument NULL (see
-     current_emacs_time).  */
-  if (tzv)
-    {
-      struct timezone *tz = (struct timezone *)tzv;
-
-      tz->tz_minuteswest = tb.timezone;        /* minutes west of Greenwich  */
-      tz->tz_dsttime = tb.dstflag;     /* type of dst correction  */
-    }
-  return 0;
-}
-
 /* Emulate fdutimens.  */
 
 /* Set the access and modification time stamps of FD (a.k.a. FILE) to be



reply via email to

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