mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-27 15:02:12 -08:00
Move some internal functions from time.d and the SI package to mislib without exporting the names.
This commit is contained in:
parent
3c75e19b61
commit
ec31caef2a
12 changed files with 72 additions and 89 deletions
|
|
@ -445,7 +445,7 @@ cl_symbols[] = {
|
|||
{"GET-OUTPUT-STREAM-STRING", CL_ORDINARY, cl_get_output_stream_string, 1, OBJNULL},
|
||||
{"GET-PROPERTIES", CL_ORDINARY, cl_get_properties, 2, OBJNULL},
|
||||
{"GET-SETF-EXPANSION", CL_ORDINARY, NULL, -1, OBJNULL},
|
||||
{"GET-UNIVERSAL-TIME", CL_ORDINARY, cl_get_universal_time, 0, OBJNULL},
|
||||
{"GET-UNIVERSAL-TIME", CL_ORDINARY, ECL_NAME(cl_get_universal_time), -1, OBJNULL},
|
||||
{"GETF", CL_ORDINARY, cl_getf, -1, OBJNULL},
|
||||
{"GETHASH", CL_ORDINARY, cl_gethash, -1, OBJNULL},
|
||||
{"GO", CL_FORM, NULL, -1, OBJNULL},
|
||||
|
|
@ -1081,7 +1081,6 @@ cl_symbols[] = {
|
|||
{SYS_ "COMPILED-FUNCTION-BLOCK", SI_ORDINARY, si_compiled_function_block, 1, OBJNULL},
|
||||
{SYS_ "COMPILED-FUNCTION-NAME", SI_ORDINARY, si_compiled_function_name, 1, OBJNULL},
|
||||
{SYS_ "COPY-STREAM", SI_ORDINARY, si_copy_stream, 1, OBJNULL},
|
||||
{SYS_ "DAYLIGHT-SAVING-TIME-P", SI_ORDINARY, si_daylight_saving_time_p, -1, OBJNULL},
|
||||
{SYS_ "DO-READ-SEQUENCE", SI_ORDINARY, si_do_read_sequence, 4, OBJNULL},
|
||||
{SYS_ "DO-WRITE-SEQUENCE", SI_ORDINARY, si_do_write_sequence, 4, OBJNULL},
|
||||
{SYS_ "ELT-SET", SI_ORDINARY, si_elt_set, 3, OBJNULL},
|
||||
|
|
@ -1106,7 +1105,6 @@ cl_symbols[] = {
|
|||
#if defined(_MSC_VER) || defined(mingw32)
|
||||
{SYS_ "GET-LIBRARY-PATHNAME", SI_ORDINARY, si_get_library_pathname, 0, OBJNULL},
|
||||
#endif
|
||||
{SYS_ "GET-LOCAL-TIME-ZONE", SI_ORDINARY, si_get_local_time_zone, 0, OBJNULL},
|
||||
{SYS_ "GET-SYSPROP", SI_ORDINARY, si_get_sysprop, 2, OBJNULL},
|
||||
{SYS_ "GET-STRING-INPUT-STREAM-INDEX", SI_ORDINARY, si_get_string_input_stream_index, 1, OBJNULL},
|
||||
{SYS_ "GETENV", SI_ORDINARY, si_getenv, 1, OBJNULL},
|
||||
|
|
|
|||
|
|
@ -445,7 +445,7 @@ cl_symbols[] = {
|
|||
{"GET-OUTPUT-STREAM-STRING","cl_get_output_stream_string"},
|
||||
{"GET-PROPERTIES","cl_get_properties"},
|
||||
{"GET-SETF-EXPANSION",NULL},
|
||||
{"GET-UNIVERSAL-TIME","cl_get_universal_time"},
|
||||
{"GET-UNIVERSAL-TIME","ECL_NAME(cl_get_universal_time)"},
|
||||
{"GETF","cl_getf"},
|
||||
{"GETHASH","cl_gethash"},
|
||||
{"GO",NULL},
|
||||
|
|
@ -1081,7 +1081,6 @@ cl_symbols[] = {
|
|||
{SYS_ "COMPILED-FUNCTION-BLOCK","si_compiled_function_block"},
|
||||
{SYS_ "COMPILED-FUNCTION-NAME","si_compiled_function_name"},
|
||||
{SYS_ "COPY-STREAM","si_copy_stream"},
|
||||
{SYS_ "DAYLIGHT-SAVING-TIME-P","si_daylight_saving_time_p"},
|
||||
{SYS_ "DO-READ-SEQUENCE","si_do_read_sequence"},
|
||||
{SYS_ "DO-WRITE-SEQUENCE","si_do_write_sequence"},
|
||||
{SYS_ "ELT-SET","si_elt_set"},
|
||||
|
|
@ -1106,7 +1105,6 @@ cl_symbols[] = {
|
|||
#if defined(_MSC_VER) || defined(mingw32)
|
||||
{SYS_ "GET-LIBRARY-PATHNAME","si_get_library_pathname"},
|
||||
#endif
|
||||
{SYS_ "GET-LOCAL-TIME-ZONE","si_get_local_time_zone"},
|
||||
{SYS_ "GET-SYSPROP","si_get_sysprop"},
|
||||
{SYS_ "GET-STRING-INPUT-STREAM-INDEX","si_get_string_input_stream_index"},
|
||||
{SYS_ "GETENV","si_getenv"},
|
||||
|
|
|
|||
56
src/c/time.d
56
src/c/time.d
|
|
@ -57,18 +57,6 @@ ecl_runtime(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
cl_object
|
||||
UTC_time_to_universal_time(cl_fixnum i)
|
||||
{
|
||||
return number_plus(bignum1(i), cl_core.Jan1st1970UT);
|
||||
}
|
||||
|
||||
cl_object
|
||||
cl_get_universal_time()
|
||||
{
|
||||
@(return UTC_time_to_universal_time(time(0)))
|
||||
}
|
||||
|
||||
cl_object
|
||||
cl_sleep(cl_object z)
|
||||
{
|
||||
|
|
@ -116,50 +104,6 @@ cl_get_internal_real_time()
|
|||
@(return MAKE_FIXNUM((time(0) - beginning)*HZ))
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the hours west of Greenwich for the current timezone.
|
||||
*
|
||||
* Based on Lott's get_timezone() function from CMU Common Lisp.
|
||||
*/
|
||||
cl_object
|
||||
si_get_local_time_zone()
|
||||
{
|
||||
struct tm ltm, gtm;
|
||||
int mw;
|
||||
time_t when = 0L;
|
||||
|
||||
ltm = *localtime(&when);
|
||||
gtm = *gmtime(&when);
|
||||
|
||||
mw = (gtm.tm_min + 60 * gtm.tm_hour) - (ltm.tm_min + 60 * ltm.tm_hour);
|
||||
|
||||
if ((gtm.tm_wday + 1) % 7 == ltm.tm_wday)
|
||||
mw -= 24*60;
|
||||
else if (gtm.tm_wday == (ltm.tm_wday + 1) % 7)
|
||||
mw += 24*60;
|
||||
|
||||
@(return make_ratio(MAKE_FIXNUM(mw), MAKE_FIXNUM(60)))
|
||||
}
|
||||
|
||||
/*
|
||||
* Return T if daylight saving is in effect at Universal Time UT, which
|
||||
* defaults to current time.
|
||||
*
|
||||
*/
|
||||
@(defun si::daylight-saving-time-p (&optional UT)
|
||||
struct tm *ltm;
|
||||
time_t when;
|
||||
@
|
||||
if (narg == 0) {
|
||||
when = time(0);
|
||||
} else { /* narg == 1 */
|
||||
cl_object UTC = number_minus(UT, cl_core.Jan1st1970UT);
|
||||
when = object_to_fixnum(UTC);
|
||||
}
|
||||
ltm = localtime(&when);
|
||||
@(return (ltm->tm_isdst ? Ct : Cnil))
|
||||
@)
|
||||
|
||||
void
|
||||
init_unixtime(void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
#include <stdlib.h>
|
||||
#include "ecl.h"
|
||||
#include "ecl-inl.h"
|
||||
#include "internal.h"
|
||||
#ifdef HAVE_DIRENT_H
|
||||
# include <dirent.h>
|
||||
#else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue