Commit 792ffa02 authored by Eli Zaretskii's avatar Eli Zaretskii

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.
parent 3af6909f
......@@ -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)
{
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment