summaryrefslogtreecommitdiff
path: root/lib-src
diff options
context:
space:
mode:
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/ChangeLog5
-rw-r--r--lib-src/ntlib.c30
2 files changed, 35 insertions, 0 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 4c25f54545..32aa985eaf 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,8 @@
+2012-09-30 Eli Zaretskii <eliz@gnu.org>
+
+ * ntlib.c (gettimeofday): Copy from src/w32.c. lib/gettime.c
+ needs this function.
+
2012-09-26 Juanma Barranquero <lekktu@gmail.com>
* makefile.w32-in (obj): Add profiler.o.
diff --git a/lib-src/ntlib.c b/lib-src/ntlib.c
index 2cc791fb56..feaad1c1bb 100644
--- a/lib-src/ntlib.c
+++ b/lib-src/ntlib.c
@@ -29,9 +29,16 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <sys/stat.h>
#include <errno.h>
#include <ctype.h>
+#include <sys/timeb.h>
#include "ntlib.h"
+struct timezone
+{
+ int tz_minuteswest; /* minutes west of Greenwich */
+ int tz_dsttime; /* type of dst correction */
+};
+
#define MAXPATHLEN _MAX_PATH
/* Emulate sleep...we could have done this with a define, but that
@@ -202,6 +209,29 @@ 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)
{