diff options
| author | Richard M. Stallman | 1995-09-10 04:37:51 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-09-10 04:37:51 +0000 |
| commit | ccc4fdaabe785f9175158ae62427441c65664858 (patch) | |
| tree | 663a9e160c24d62b34c2ef231f2a82579adfb7fa /src | |
| parent | 143cb9a97724176739fc4498afe6110ad8bfd165 (diff) | |
| download | emacs-ccc4fdaabe785f9175158ae62427441c65664858.tar.gz emacs-ccc4fdaabe785f9175158ae62427441c65664858.zip | |
(gettimeofday): Don't bother setting time zone,
since nobody uses it, and our hacks to get it get in the way
of the above fix. Use simpler method for getting time stamp.
(init_gettimeofday, daylight, gmtoffset): Remove.
Diffstat (limited to 'src')
| -rw-r--r-- | src/msdos.c | 45 |
1 files changed, 6 insertions, 39 deletions
diff --git a/src/msdos.c b/src/msdos.c index c93da0bc942..dc48834c0e3 100644 --- a/src/msdos.c +++ b/src/msdos.c | |||
| @@ -885,8 +885,6 @@ init_environment (argc, argv, skip_args) | |||
| 885 | setenv ("TZ", "EET-02", 0); | 885 | setenv ("TZ", "EET-02", 0); |
| 886 | break; | 886 | break; |
| 887 | } | 887 | } |
| 888 | tzset (); | ||
| 889 | init_gettimeofday (); | ||
| 890 | } | 888 | } |
| 891 | 889 | ||
| 892 | /* Flash the screen as a substitute for BEEPs. */ | 890 | /* Flash the screen as a substitute for BEEPs. */ |
| @@ -1417,10 +1415,7 @@ internal_terminal_init () | |||
| 1417 | 1415 | ||
| 1418 | /* When time zones are set from Ms-Dos too may C-libraries are playing | 1416 | /* When time zones are set from Ms-Dos too may C-libraries are playing |
| 1419 | tricks with time values. We solve this by defining our own version | 1417 | tricks with time values. We solve this by defining our own version |
| 1420 | of `gettimeofday' bypassing GO32. Our version needs to be initialized | 1418 | of `gettimeofday' bypassing GO32. */ |
| 1421 | once and after each call to `tzset' with TZ changed. */ | ||
| 1422 | |||
| 1423 | static int daylight, gmtoffset; | ||
| 1424 | 1419 | ||
| 1425 | int | 1420 | int |
| 1426 | gettimeofday (struct timeval *tp, struct timezone *tzp) | 1421 | gettimeofday (struct timeval *tp, struct timezone *tzp) |
| @@ -1428,44 +1423,16 @@ gettimeofday (struct timeval *tp, struct timezone *tzp) | |||
| 1428 | if (tp) | 1423 | if (tp) |
| 1429 | { | 1424 | { |
| 1430 | struct time t; | 1425 | struct time t; |
| 1431 | struct date d; | ||
| 1432 | struct tm tmrec; | ||
| 1433 | 1426 | ||
| 1434 | gettime (&t); | 1427 | gettime (&t); |
| 1435 | getdate (&d); | 1428 | tp->tv_sec = time (NULL); |
| 1436 | tmrec.tm_year = d.da_year - 1900; | 1429 | /* If tp->tv_sec%60 != t.ti_sec, the seconds counter turned over |
| 1437 | tmrec.tm_mon = d.da_mon - 1; | 1430 | between the call to `gettime' and the call to `time'. */ |
| 1438 | tmrec.tm_mday = d.da_day; | 1431 | tp->tv_usec = tp->tv_sec%60 != t.ti_sec ? 0 : t.ti_hund * (1000000/100); |
| 1439 | tmrec.tm_hour = t.ti_hour; | ||
| 1440 | tmrec.tm_min = t.ti_min; | ||
| 1441 | tmrec.tm_sec = t.ti_sec; | ||
| 1442 | tmrec.tm_gmtoff = gmtoffset; | ||
| 1443 | tmrec.tm_isdst = daylight; | ||
| 1444 | tp->tv_sec = mktime (&tmrec); | ||
| 1445 | tp->tv_usec = t.ti_hund * (1000000 / 100); | ||
| 1446 | } | ||
| 1447 | if (tzp) | ||
| 1448 | { | ||
| 1449 | tzp->tz_minuteswest = gmtoffset; | ||
| 1450 | tzp->tz_dsttime = daylight; | ||
| 1451 | } | 1432 | } |
| 1433 | /* Ignore tzp; it's obsolescent. */ | ||
| 1452 | return 0; | 1434 | return 0; |
| 1453 | } | 1435 | } |
| 1454 | |||
| 1455 | void | ||
| 1456 | init_gettimeofday () | ||
| 1457 | { | ||
| 1458 | time_t ltm, gtm; | ||
| 1459 | struct tm *lstm; | ||
| 1460 | |||
| 1461 | daylight = 0; | ||
| 1462 | gmtoffset = 0; | ||
| 1463 | ltm = gtm = time (NULL); | ||
| 1464 | ltm = mktime (lstm = localtime (<m)); | ||
| 1465 | gtm = mktime (gmtime (>m)); | ||
| 1466 | daylight = lstm->tm_isdst; | ||
| 1467 | gmtoffset = (int)(gtm - ltm) / 60; | ||
| 1468 | } | ||
| 1469 | 1436 | ||
| 1470 | /* These must be global. */ | 1437 | /* These must be global. */ |
| 1471 | static _go32_dpmi_seginfo ctrl_break_vector; | 1438 | static _go32_dpmi_seginfo ctrl_break_vector; |