From 785ba5e3eba6d1857217022289ff8f22a491b169 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Sun, 23 Apr 1995 03:16:49 +0000 Subject: [PATCH] Extend the time decode/encode primitives to handle daylight savings time information. --- v7/src/microcode/dosenv.c | 8 ++------ v7/src/microcode/ntenv.c | 8 ++------ v7/src/microcode/os2env.c | 4 ++-- v7/src/microcode/uxenv.c | 14 ++------------ 4 files changed, 8 insertions(+), 26 deletions(-) diff --git a/v7/src/microcode/dosenv.c b/v7/src/microcode/dosenv.c index 13570039d..03d0a81ad 100644 --- a/v7/src/microcode/dosenv.c +++ b/v7/src/microcode/dosenv.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: dosenv.c,v 1.7 1995/04/23 03:04:52 cph Exp $ +$Id: dosenv.c,v 1.8 1995/04/23 03:16:35 cph Exp $ Copyright (c) 1992-95 Massachusetts Institute of Technology @@ -75,11 +75,7 @@ DEFUN (OS_encode_time ,(buffer), struct time_structure * buffer) (ts -> tm_hour) = (buffer -> hour); (ts -> tm_min) = (buffer -> minute); (ts -> tm_sec) = (buffer -> second); - { - /* In localtime() encoding, 0 is Sunday; in ours, it's Monday. */ - int wday = (buffer -> day_of_week); - (ts -> tm_wday) = ((wday == 6) ? 0 : (wday + 1)); - } + (ts -> tm_isdst) = (buffer -> daylight_savings_time); STD_UINT_SYSTEM_CALL (syscall_mktime, t, (DOS_mktime (ts))); return (t); } diff --git a/v7/src/microcode/ntenv.c b/v7/src/microcode/ntenv.c index e16907145..9587a49b0 100644 --- a/v7/src/microcode/ntenv.c +++ b/v7/src/microcode/ntenv.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: ntenv.c,v 1.11 1995/04/23 03:04:00 cph Exp $ +$Id: ntenv.c,v 1.12 1995/04/23 03:16:24 cph Exp $ Copyright (c) 1992-95 Massachusetts Institute of Technology @@ -78,11 +78,7 @@ DEFUN (OS_encode_time ,(buffer), struct time_structure * buffer) (ts -> tm_hour) = (buffer -> hour); (ts -> tm_min) = (buffer -> minute); (ts -> tm_sec) = (buffer -> second); - { - /* In localtime() encoding, 0 is Sunday; in ours, it's Monday. */ - int wday = (buffer -> day_of_week); - (ts -> tm_wday) = ((wday == 6) ? 0 : (wday + 1)); - } + (ts -> tm_isdst) = (buffer -> daylight_savings_time); STD_UINT_SYSTEM_CALL (syscall_mktime, t, (NT_mktime (ts))); return (t); } diff --git a/v7/src/microcode/os2env.c b/v7/src/microcode/os2env.c index c5409ccf5..83e3f65e0 100644 --- a/v7/src/microcode/os2env.c +++ b/v7/src/microcode/os2env.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: os2env.c,v 1.4 1995/04/23 03:03:44 cph Exp $ +$Id: os2env.c,v 1.5 1995/04/23 03:16:49 cph Exp $ Copyright (c) 1994-95 Massachusetts Institute of Technology @@ -104,7 +104,7 @@ OS_encode_time (struct time_structure * buffer) (ts . tm_hour) = (buffer -> hour); (ts . tm_min) = (buffer -> minute); (ts . tm_sec) = (buffer -> second); - (ts . tm_isdst) = -1; /* Let mktime figure it out */ + (ts . tm_isdst) = (buffer -> daylight_savings_time); { time_t t = (mktime (&ts)); if (t < 0) diff --git a/v7/src/microcode/uxenv.c b/v7/src/microcode/uxenv.c index 6645597df..8ba47f409 100644 --- a/v7/src/microcode/uxenv.c +++ b/v7/src/microcode/uxenv.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: uxenv.c,v 1.13 1995/04/23 03:04:58 cph Exp $ +$Id: uxenv.c,v 1.14 1995/04/23 03:16:42 cph Exp $ Copyright (c) 1990-95 Massachusetts Institute of Technology @@ -75,17 +75,7 @@ DEFUN (OS_encode_time ,(buffer), struct time_structure * buffer) (ts -> tm_hour) = (buffer -> hour); (ts -> tm_min) = (buffer -> minute); (ts -> tm_sec) = (buffer -> second); -#if 0 - { - /* In localtime() encoding, 0 is Sunday; in ours, it's Monday. */ - int wday = (buffer -> day_of_week); - (ts -> tm_wday) = ((wday == 6) ? 0 : (wday + 1)); - } -#else - (ts -> tm_wday) = 0; -#endif - (ts -> tm_yday) = 0; - (ts -> tm_isdst) = -1; /* Let mktime figure it out */ + (ts -> tm_isdst) = (buffer -> daylight_savings_time); #ifdef HAVE_MKTIME STD_UINT_SYSTEM_CALL (syscall_mktime, t, (UX_mktime (ts))); #else -- 2.25.1