/* -*-C-*-
-$Id: dosenv.c,v 1.8 1995/04/23 03:16:35 cph Exp $
+$Id: dosenv.c,v 1.9 1996/04/23 20:40:19 cph Exp $
-Copyright (c) 1992-95 Massachusetts Institute of Technology
+Copyright (c) 1992-96 Massachusetts Institute of Technology
This material was developed by the Scheme project at the Massachusetts
Institute of Technology, Department of Electrical Engineering and
(buffer -> minute) = (ts -> tm_min);
(buffer -> second) = (ts -> tm_sec);
(buffer -> daylight_savings_time) = (ts -> tm_isdst);
+ /* I'm assuming that `timezone' is implemented by the C library;
+ this might need conditionalization. -- cph */
+ (buffer -> time_zone) = timezone;
{
/* In localtime() encoding, 0 is Sunday; in ours, it's Monday. */
int wday = (ts -> tm_wday);
(ts -> tm_sec) = (buffer -> second);
(ts -> tm_isdst) = (buffer -> daylight_savings_time);
STD_UINT_SYSTEM_CALL (syscall_mktime, t, (DOS_mktime (ts)));
+ /* mktime assumes its argument is local time, and converts it to
+ UTC; if the specified time zone is different, adjust the result. */
+ if (((buffer -> time_zone) != INT_MAX)
+ && ((buffer -> time_zone) != timezone))
+ t = ((t - timezone) + (buffer -> time_zone));
return (t);
}
/* -*-C-*-
-$Id: ntenv.c,v 1.12 1995/04/23 03:16:24 cph Exp $
+$Id: ntenv.c,v 1.13 1996/04/23 20:40:11 cph Exp $
-Copyright (c) 1992-95 Massachusetts Institute of Technology
+Copyright (c) 1992-96 Massachusetts Institute of Technology
This material was developed by the Scheme project at the Massachusetts
Institute of Technology, Department of Electrical Engineering and
(buffer -> minute) = (ts -> tm_min);
(buffer -> second) = (ts -> tm_sec);
(buffer -> daylight_savings_time) = (ts -> tm_isdst);
+ /* I'm assuming that `timezone' is implemented by the C library;
+ this might need conditionalization. -- cph */
+ (buffer -> time_zone) = timezone;
{
/* In localtime() encoding, 0 is Sunday; in ours, it's Monday. */
int wday = (ts -> tm_wday);
(ts -> tm_sec) = (buffer -> second);
(ts -> tm_isdst) = (buffer -> daylight_savings_time);
STD_UINT_SYSTEM_CALL (syscall_mktime, t, (NT_mktime (ts)));
+ /* mktime assumes its argument is local time, and converts it to
+ UTC; if the specified time zone is different, adjust the result. */
+ if (((buffer -> time_zone) != INT_MAX)
+ && ((buffer -> time_zone) != timezone))
+ t = ((t - timezone) + (buffer -> time_zone));
return (t);
}
/* -*-C-*-
-$Id: os2env.c,v 1.9 1995/10/15 00:37:52 cph Exp $
+$Id: os2env.c,v 1.10 1996/04/23 20:40:03 cph Exp $
-Copyright (c) 1994-95 Massachusetts Institute of Technology
+Copyright (c) 1994-96 Massachusetts Institute of Technology
This material was developed by the Scheme project at the Massachusetts
Institute of Technology, Department of Electrical Engineering and
(buffer -> minute) = (ts -> tm_min);
(buffer -> second) = (ts -> tm_sec);
(buffer -> daylight_savings_time) = (ts -> tm_isdst);
+#ifdef NC_TIMEZONE
+ (buffer -> time_zone) = NC_TIMEZONE;
+#else
+ (buffer -> time_zone) = INT_MAX;
+#endif
{
/* In localtime() encoding, 0 is Sunday; in ours, it's Monday. */
int wday = (ts -> tm_wday);
time_t t = (mktime (&ts));
if (t < 0)
OS2_error_system_call (errno, syscall_mktime);
+#ifdef NC_TIMEZONE
+ /* mktime assumes its argument is local time, and converts it to
+ UTC; if the specified time zone is different, adjust the result. */
+ if (((buffer -> time_zone) != INT_MAX)
+ && ((buffer -> time_zone) != NC_TIMEZONE))
+ t = ((t - NC_TIMEZONE) + (buffer -> time_zone));
+#endif
return (t);
}
}
{
#ifdef NC_TIMEZONE
return (NC_TIMEZONE);
+#else
+ return (0);
#endif
}
{
#ifdef NC_DAYLIGHT
return (NC_DAYLIGHT);
+#else
+ return (-1);
#endif
}
/* -*-C-*-
-$Id: osenv.h,v 1.6 1995/04/23 03:04:07 cph Exp $
+$Id: osenv.h,v 1.7 1996/04/23 20:39:46 cph Exp $
-Copyright (c) 1990-95 Massachusetts Institute of Technology
+Copyright (c) 1990-96 Massachusetts Institute of Technology
This material was developed by the Scheme project at the Massachusetts
Institute of Technology, Department of Electrical Engineering and
unsigned int second;
unsigned int day_of_week;
int daylight_savings_time;
+ int time_zone;
};
extern time_t EXFUN (OS_encoded_time, ());
/* -*-C-*-
-$Id: prosenv.c,v 1.12 1995/04/23 03:03:31 cph Exp $
+$Id: prosenv.c,v 1.13 1996/04/23 20:39:56 cph Exp $
-Copyright (c) 1987-95 Massachusetts Institute of Technology
+Copyright (c) 1987-96 Massachusetts Institute of Technology
This material was developed by the Scheme project at the Massachusetts
Institute of Technology, Department of Electrical Engineering and
#include "prims.h"
#include "osenv.h"
#include "ostop.h"
+#include "limits.h"
\f
DEFINE_PRIMITIVE ("ENCODED-TIME", Prim_encoded_time, 0, 0,
"Return the current time as an integer.")
DEFINE_PRIMITIVE ("DECODE-TIME", Prim_decode_time, 2, 2,
"Fill a vector with the second argument decoded.\n\
The vector's elements are:\n\
- #(TAG second minute hour day month year day-of-week dst)")
+ #(TAG second minute hour day month year day-of-week dst zone)")
{
SCHEME_OBJECT vec;
unsigned int len;
FAST_VECTOR_SET (vec, 7, (long_to_integer (ts . day_of_week)));
if (len > 8)
FAST_VECTOR_SET (vec, 8, (long_to_integer (ts . daylight_savings_time)));
+ if (len > 9)
+ FAST_VECTOR_SET
+ (vec, 9,
+ (((ts . time_zone) == INT_MAX)
+ ? SHARP_F
+ : (long_to_integer (ts . time_zone))));
PRIMITIVE_RETURN (UNSPECIFIC);
}
= ((len > 8)
? (integer_to_long (FAST_VECTOR_REF (vec, 8)))
: (-1));
+ (ts . time_zone)
+ = (((len > 9)
+ && (INTEGER_P (FAST_VECTOR_REF (vec, 9)))
+ && (integer_to_long_p (FAST_VECTOR_REF (vec, 9))))
+ ? (integer_to_long (FAST_VECTOR_REF (vec, 9)))
+ : INT_MAX);
PRIMITIVE_RETURN (long_to_integer ((long) (OS_encode_time (&ts))));
}
\f
/* -*-C-*-
-$Id: ux.h,v 1.62 1995/06/29 23:47:45 cph Exp $
+$Id: ux.h,v 1.63 1996/04/23 20:42:41 cph Exp $
-Copyright (c) 1988-94 Massachusetts Institute of Technology
+Copyright (c) 1988-96 Massachusetts Institute of Technology
This material was developed by the Scheme project at the Massachusetts
Institute of Technology, Department of Electrical Engineering and
#define HAVE_GETCWD
#define HAVE_TERMIO
#define HAVE_TIMES
+#define HAVE_TIMEZONE
#define AMBIGUOUS_NONBLOCK
#define ERRNO_NONBLOCK EAGAIN
#define SYSTEM_VARIANT "Linux"
#include <sys/time.h>
#define HAVE_FTRUNCATE
+#define HAVE_STATFS
+#define HAVE_TIMEZONE
#endif
#ifdef _ULTRIX
#define UX_dup dup
#define UX_free free
#define UX_fstat fstat
+#define UX_fstatfs fstatfs
#define UX_getegid getegid
#define UX_getenv getenv
#define UX_geteuid geteuid
#define UX_signal signal
#define UX_sleep sleep
#define UX_stat stat
+#define UX_statfs statfs
#define UX_system system
#define UX_time time
#define UX_unlink unlink
/* -*-C-*-
-$Id: uxenv.c,v 1.14 1995/04/23 03:16:42 cph Exp $
+$Id: uxenv.c,v 1.15 1996/04/23 20:44:15 cph Exp $
-Copyright (c) 1990-95 Massachusetts Institute of Technology
+Copyright (c) 1990-96 Massachusetts Institute of Technology
This material was developed by the Scheme project at the Massachusetts
Institute of Technology, Department of Electrical Engineering and
(buffer -> minute) = (ts -> tm_min);
(buffer -> second) = (ts -> tm_sec);
(buffer -> daylight_savings_time) = (ts -> tm_isdst);
+#ifdef HAVE_TIMEZONE
+ (buffer -> time_zone) = timezone;
+#else
+ (buffer -> time_zone) = INT_MAX;
+#endif
{
/* In localtime() encoding, 0 is Sunday; in ours, it's Monday. */
int wday = (ts -> tm_wday);
STD_UINT_SYSTEM_CALL (syscall_mktime, t, (UX_mktime (ts)));
#else
error_system_call (ENOSYS, syscall_mktime);
+#endif
+#ifdef HAVE_TIMEZONE
+ /* mktime assumes its argument is local time, and converts it to
+ UTC; if the specified time zone is different, adjust the result. */
+ if (((buffer -> time_zone) != INT_MAX)
+ && ((buffer -> time_zone) != timezone))
+ t = ((t - timezone) + (buffer -> time_zone));
#endif
return (t);
}