diff options
| author | Tom Tromey | 2012-12-17 07:56:22 -0700 |
|---|---|---|
| committer | Tom Tromey | 2012-12-17 07:56:22 -0700 |
| commit | 3d6eced1ae51ffd0a782130e7c334052277e2724 (patch) | |
| tree | 5d1d2ad7cd3374f922886c4a72062511a035c168 /lib-src/ntlib.c | |
| parent | bf69f522a9e135f9aa483cedd53e71e915f2bf75 (diff) | |
| parent | 7c3d167f48d6262ee4e5512aa50a07ee96bc1509 (diff) | |
| download | emacs-3d6eced1ae51ffd0a782130e7c334052277e2724.tar.gz emacs-3d6eced1ae51ffd0a782130e7c334052277e2724.zip | |
merge from trunk
Diffstat (limited to 'lib-src/ntlib.c')
| -rw-r--r-- | lib-src/ntlib.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/lib-src/ntlib.c b/lib-src/ntlib.c index 2cc791fb56a..4e125eb6d73 100644 --- a/lib-src/ntlib.c +++ b/lib-src/ntlib.c | |||
| @@ -29,9 +29,17 @@ 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> | ||
| 33 | #include <mbstring.h> | ||
| 32 | 34 | ||
| 33 | #include "ntlib.h" | 35 | #include "ntlib.h" |
| 34 | 36 | ||
| 37 | struct timezone | ||
| 38 | { | ||
| 39 | int tz_minuteswest; /* minutes west of Greenwich */ | ||
| 40 | int tz_dsttime; /* type of dst correction */ | ||
| 41 | }; | ||
| 42 | |||
| 35 | #define MAXPATHLEN _MAX_PATH | 43 | #define MAXPATHLEN _MAX_PATH |
| 36 | 44 | ||
| 37 | /* Emulate sleep...we could have done this with a define, but that | 45 | /* Emulate sleep...we could have done this with a define, but that |
| @@ -202,6 +210,29 @@ getpass (const char * prompt) | |||
| 202 | return NULL; | 210 | return NULL; |
| 203 | } | 211 | } |
| 204 | 212 | ||
| 213 | /* This is needed because lib/gettime.c calls gettimeofday, which MSVC | ||
| 214 | doesn't have. Copied from w32.c. */ | ||
| 215 | void | ||
| 216 | gettimeofday (struct timeval *tv, struct timezone *tz) | ||
| 217 | { | ||
| 218 | struct _timeb tb; | ||
| 219 | _ftime (&tb); | ||
| 220 | |||
| 221 | tv->tv_sec = tb.time; | ||
| 222 | tv->tv_usec = tb.millitm * 1000L; | ||
| 223 | /* Implementation note: _ftime sometimes doesn't update the dstflag | ||
| 224 | according to the new timezone when the system timezone is | ||
| 225 | changed. We could fix that by using GetSystemTime and | ||
| 226 | GetTimeZoneInformation, but that doesn't seem necessary, since | ||
| 227 | Emacs always calls gettimeofday with the 2nd argument NULL (see | ||
| 228 | current_emacs_time). */ | ||
| 229 | if (tz) | ||
| 230 | { | ||
| 231 | tz->tz_minuteswest = tb.timezone; /* minutes west of Greenwich */ | ||
| 232 | tz->tz_dsttime = tb.dstflag; /* type of dst correction */ | ||
| 233 | } | ||
| 234 | } | ||
| 235 | |||
| 205 | int | 236 | int |
| 206 | fchown (int fd, unsigned uid, unsigned gid) | 237 | fchown (int fd, unsigned uid, unsigned gid) |
| 207 | { | 238 | { |