/* -*-C-*-
-$Id: ntapi.h,v 1.10 1999/03/09 05:39:03 cph Exp $
+$Id: ntapi.h,v 1.11 1999/04/07 04:01:43 cph Exp $
Copyright (c) 1997, 1999 Massachusetts Institute of Technology
syscall_close,
syscall_fstat,
syscall_getcwd,
+ syscall_gmtime,
syscall_localtime,
syscall_lseek,
syscall_malloc,
"CLOSE",
"FSTAT",
"GETCWD",
+ "GMTIME",
"LOCALTIME",
"LSEEK",
"MALLOC",
/* -*-C-*-
-$Id: ntenv.c,v 1.17 1999/01/02 06:11:34 cph Exp $
+$Id: ntenv.c,v 1.18 1999/04/07 04:01:44 cph Exp $
Copyright (c) 1992-1999 Massachusetts Institute of Technology
}
}
+void
+OS_decode_utc (time_t t, struct time_structure * buffer)
+{
+ struct tm * ts;
+ STD_PTR_UNIX_CALL (ts, gmtime, (&t));
+ (buffer -> year) = ((ts -> tm_year) + 1900);
+ (buffer -> month) = ((ts -> tm_mon) + 1);
+ (buffer -> day) = (ts -> tm_mday);
+ (buffer -> hour) = (ts -> tm_hour);
+ (buffer -> minute) = (ts -> tm_min);
+ (buffer -> second) = (ts -> tm_sec);
+ (buffer -> daylight_savings_time) = (ts -> tm_isdst);
+ (buffer -> time_zone) = 0;
+ {
+ /* In gmtime() encoding, 0 is Sunday; in ours, it's Monday. */
+ int wday = (ts -> tm_wday);
+ (buffer -> day_of_week) = ((wday == 0) ? 6 : (wday - 1));
+ }
+}
+
#if 0
/* This nice implementation can't be used because it only works under
Windows NT. */
/* -*-C-*-
-$Id: os2api.h,v 1.11 1999/01/02 06:11:34 cph Exp $
+$Id: os2api.h,v 1.12 1999/04/07 04:01:45 cph Exp $
Copyright (c) 1994-1999 Massachusetts Institute of Technology
syscall_dos_write,
syscall_dos_write_queue,
syscall_beginthread,
+ syscall_gmtime,
syscall_kbd_char_in,
syscall_localtime,
syscall_malloc,
"dos-write",
"dos-write-queue",
"beginthread",
+ "gmtime",
"kbd-char-in",
"localtime",
"malloc",
/* -*-C-*-
-$Id: os2env.c,v 1.11 1999/01/02 06:11:34 cph Exp $
+$Id: os2env.c,v 1.12 1999/04/07 04:01:45 cph Exp $
Copyright (c) 1994-1999 Massachusetts Institute of Technology
}
}
+void
+OS_decode_utc (time_t t, struct time_structure * buffer)
+{
+ struct tm * ts = (gmtime (&t));
+ if (ts == 0)
+ OS2_error_system_call (errno, syscall_gmtime);
+ (buffer -> year) = ((ts -> tm_year) + 1900);
+ (buffer -> month) = ((ts -> tm_mon) + 1);
+ (buffer -> day) = (ts -> tm_mday);
+ (buffer -> hour) = (ts -> tm_hour);
+ (buffer -> minute) = (ts -> tm_min);
+ (buffer -> second) = (ts -> tm_sec);
+ (buffer -> daylight_savings_time) = (ts -> tm_isdst);
+ (buffer -> time_zone) = 0;
+ {
+ /* In gmtime() encoding, 0 is Sunday; in ours, it's Monday. */
+ int wday = (ts -> tm_wday);
+ (buffer -> day_of_week) = ((wday == 0) ? 6 : (wday - 1));
+ }
+}
+
time_t
OS_encode_time (struct time_structure * buffer)
{
/* -*-C-*-
-$Id: prosenv.c,v 1.15 1999/01/02 06:11:34 cph Exp $
+$Id: prosenv.c,v 1.16 1999/04/07 04:01:46 cph Exp $
Copyright (c) 1987-1999 Massachusetts Institute of Technology
PRIMITIVE_RETURN (ulong_to_integer ((unsigned long) (OS_encoded_time ())));
}
+#define DECODE_TIME_BODY(proc) \
+{ \
+ PRIMITIVE_HEADER (2); \
+ { \
+ SCHEME_OBJECT vec = (VECTOR_ARG (1)); \
+ unsigned int len = (VECTOR_LENGTH (vec)); \
+ struct time_structure ts; \
+ if (! (len >= 10)) \
+ error_bad_range_arg (1); \
+ proc (((time_t) (arg_ulong_integer (2))), &ts); \
+ FAST_VECTOR_SET (vec, 1, (ulong_to_integer (ts . second))); \
+ FAST_VECTOR_SET (vec, 2, (ulong_to_integer (ts . minute))); \
+ FAST_VECTOR_SET (vec, 3, (ulong_to_integer (ts . hour))); \
+ FAST_VECTOR_SET (vec, 4, (ulong_to_integer (ts . day))); \
+ FAST_VECTOR_SET (vec, 5, (ulong_to_integer (ts . month))); \
+ FAST_VECTOR_SET (vec, 6, (ulong_to_integer (ts . year))); \
+ FAST_VECTOR_SET (vec, 7, (ulong_to_integer (ts . day_of_week))); \
+ FAST_VECTOR_SET \
+ (vec, 8, (ulong_to_integer (ts . daylight_savings_time))); \
+ FAST_VECTOR_SET \
+ (vec, 9, \
+ (((ts . time_zone) == INT_MAX) \
+ ? SHARP_F \
+ : (ulong_to_integer (ts . time_zone)))); \
+ } \
+ PRIMITIVE_RETURN (UNSPECIFIC); \
+}
+
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 zone)")
-{
- SCHEME_OBJECT vec;
- unsigned int len;
- struct time_structure ts;
- PRIMITIVE_HEADER (1);
+DECODE_TIME_BODY (OS_decode_time)
- vec = (VECTOR_ARG (1));
- len = (VECTOR_LENGTH (vec));
- if (! (len >= 8))
- error_bad_range_arg (1);
- OS_decode_time (((time_t) (arg_ulong_integer (2))), &ts);
- FAST_VECTOR_SET (vec, 1, (ulong_to_integer (ts . second)));
- FAST_VECTOR_SET (vec, 2, (ulong_to_integer (ts . minute)));
- FAST_VECTOR_SET (vec, 3, (ulong_to_integer (ts . hour)));
- FAST_VECTOR_SET (vec, 4, (ulong_to_integer (ts . day)));
- FAST_VECTOR_SET (vec, 5, (ulong_to_integer (ts . month)));
- FAST_VECTOR_SET (vec, 6, (ulong_to_integer (ts . year)));
- FAST_VECTOR_SET (vec, 7, (ulong_to_integer (ts . day_of_week)));
- if (len > 8)
- FAST_VECTOR_SET (vec, 8, (ulong_to_integer (ts . daylight_savings_time)));
- if (len > 9)
- FAST_VECTOR_SET
- (vec, 9,
- (((ts . time_zone) == INT_MAX)
- ? SHARP_F
- : (ulong_to_integer (ts . time_zone))));
- PRIMITIVE_RETURN (UNSPECIFIC);
-}
+DEFINE_PRIMITIVE ("DECODE-UTC", Prim_decode_utc, 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 zone)")
+DECODE_TIME_BODY (OS_decode_utc)
DEFINE_PRIMITIVE ("ENCODE-TIME", Prim_encode_time, 1, 1,
"Return the file time corresponding to the time structure given.")
/* -*-C-*-
-$Id: syscall.h,v 1.11 1999/01/02 06:11:34 cph Exp $
+$Id: syscall.h,v 1.12 1999/04/07 04:01:47 cph Exp $
Copyright (c) 1993-1999 Massachusetts Institute of Technology
syscall_getcwd,
syscall_gethostname,
syscall_gettimeofday,
+ syscall_gmtime,
syscall_ioctl_TIOCGPGRP,
syscall_ioctl_TIOCSIGSEND,
syscall_kill,
/* -*-C-*-
-$Id: ux.h,v 1.71 1999/01/02 06:11:34 cph Exp $
+$Id: ux.h,v 1.72 1999/04/07 04:01:47 cph Exp $
Copyright (c) 1988-1999 Massachusetts Institute of Technology
#define UX_getpwnam getpwnam
#define UX_getpwuid getpwuid
#define UX_getuid getuid
+#define UX_gmtime gmtime
#define UX_ioctl ioctl
#define UX_link link
#define UX_localtime localtime
/* -*-C-*-
-$Id: uxenv.c,v 1.17 1999/01/02 06:11:34 cph Exp $
+$Id: uxenv.c,v 1.18 1999/04/07 04:01:48 cph Exp $
Copyright (c) 1990-1999 Massachusetts Institute of Technology
}
}
+void
+DEFUN (OS_decode_utc, (t, buffer), time_t t AND struct time_structure * buffer)
+{
+ struct tm * ts;
+ STD_PTR_SYSTEM_CALL (syscall_gmtime, ts, (UX_gmtime (&t)));
+ (buffer -> year) = ((ts -> tm_year) + 1900);
+ (buffer -> month) = ((ts -> tm_mon) + 1);
+ (buffer -> day) = (ts -> tm_mday);
+ (buffer -> hour) = (ts -> tm_hour);
+ (buffer -> minute) = (ts -> tm_min);
+ (buffer -> second) = (ts -> tm_sec);
+ (buffer -> daylight_savings_time) = (ts -> tm_isdst);
+ (buffer -> time_zone) = 0;
+ {
+ /* In gmtime() encoding, 0 is Sunday; in ours, it's Monday. */
+ int wday = (ts -> tm_wday);
+ (buffer -> day_of_week) = ((wday == 0) ? 6 : (wday - 1));
+ }
+}
+
time_t
DEFUN (OS_encode_time ,(buffer), struct time_structure * buffer)
{
/* -*-C-*-
-$Id: uxtop.c,v 1.21 1999/01/02 06:11:34 cph Exp $
+$Id: uxtop.c,v 1.22 1999/04/07 04:01:49 cph Exp $
Copyright (c) 1990-1999 Massachusetts Institute of Technology
"GETCWD",
"GETHOSTNAME",
"GETTIMEOFDAY",
+ "GMTIME",
"IOCTL-TIOCGPGRP",
"IOCTL-TIOCSIGSEND",
"KILL",
/* -*-C-*-
-$Id: version.h,v 11.162 1999/03/03 05:25:28 cph Exp $
+$Id: version.h,v 11.163 1999/04/07 04:01:55 cph Exp $
Copyright (c) 1988-1999 Massachusetts Institute of Technology
#define VERSION 11
#endif
#ifndef SUBVERSION
-#define SUBVERSION 162
+#define SUBVERSION 163
#endif