aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src/ntlib.c
diff options
context:
space:
mode:
authorKenichi Handa2012-10-06 21:55:09 +0900
committerKenichi Handa2012-10-06 21:55:09 +0900
commit16ddec7e9e6adcf615db097d9627d490ca29208c (patch)
tree1c16b9565c9cca81ec8f5b10f0f4110340d4654a /lib-src/ntlib.c
parent2b89bca49d55cec1a004353354a76de2972c68f3 (diff)
parentd5acb99a199d83cde1a43482709c3e9d4ec34b2f (diff)
downloademacs-16ddec7e9e6adcf615db097d9627d490ca29208c.tar.gz
emacs-16ddec7e9e6adcf615db097d9627d490ca29208c.zip
merge trunk
Diffstat (limited to 'lib-src/ntlib.c')
-rw-r--r--lib-src/ntlib.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib-src/ntlib.c b/lib-src/ntlib.c
index 2cc791fb56a..feaad1c1bb7 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/>. */
29#include <sys/stat.h> 29#include <sys/stat.h>
30#include <errno.h> 30#include <errno.h>
31#include <ctype.h> 31#include <ctype.h>
32#include <sys/timeb.h>
32 33
33#include "ntlib.h" 34#include "ntlib.h"
34 35
36struct timezone
37{
38 int tz_minuteswest; /* minutes west of Greenwich */
39 int tz_dsttime; /* type of dst correction */
40};
41
35#define MAXPATHLEN _MAX_PATH 42#define MAXPATHLEN _MAX_PATH
36 43
37/* Emulate sleep...we could have done this with a define, but that 44/* Emulate sleep...we could have done this with a define, but that
@@ -202,6 +209,29 @@ getpass (const char * prompt)
202 return NULL; 209 return NULL;
203} 210}
204 211
212/* This is needed because lib/gettime.c calls gettimeofday, which MSVC
213 doesn't have. Copied from w32.c. */
214void
215gettimeofday (struct timeval *tv, struct timezone *tz)
216{
217 struct _timeb tb;
218 _ftime (&tb);
219
220 tv->tv_sec = tb.time;
221 tv->tv_usec = tb.millitm * 1000L;
222 /* Implementation note: _ftime sometimes doesn't update the dstflag
223 according to the new timezone when the system timezone is
224 changed. We could fix that by using GetSystemTime and
225 GetTimeZoneInformation, but that doesn't seem necessary, since
226 Emacs always calls gettimeofday with the 2nd argument NULL (see
227 current_emacs_time). */
228 if (tz)
229 {
230 tz->tz_minuteswest = tb.timezone; /* minutes west of Greenwich */
231 tz->tz_dsttime = tb.dstflag; /* type of dst correction */
232 }
233}
234
205int 235int
206fchown (int fd, unsigned uid, unsigned gid) 236fchown (int fd, unsigned uid, unsigned gid)
207{ 237{