From e2dffd97feba6345700ea3c8a9594966adc79a99 Mon Sep 17 00:00:00 2001 From: Lassi Kortela Date: Mon, 19 Aug 2019 01:15:28 +0300 Subject: [PATCH] Remove time.now and parsetime functions --- c/builtins.c | 12 ------------ c/time_unix.c | 28 ---------------------------- c/time_windows.c | 10 ---------- c/timefuncs.h | 2 -- 4 files changed, 52 deletions(-) diff --git a/c/builtins.c b/c/builtins.c index f908d20..d313451 100644 --- a/c/builtins.c +++ b/c/builtins.c @@ -2,7 +2,6 @@ Extra femtoLisp builtin functions */ -#include #include #include @@ -20,8 +19,6 @@ #include "utils.h" #include "utf8.h" #include "ios.h" -#include "socket.h" -#include "timefuncs.h" #include "hashing.h" #include "htable.h" #include "htableh_inc.h" @@ -336,13 +333,6 @@ static value_t fl_vector_alloc(value_t *args, uint32_t nargs) return v; } -static value_t fl_time_now(value_t *args, uint32_t nargs) -{ - argcount("time.now", nargs, 0); - (void)args; - return mk_double(clock_now()); -} - static double todouble(value_t a, char *fname) { if (isfixnum(a)) @@ -520,8 +510,6 @@ static struct builtinspec builtin_info[] = { { "vector.alloc", fl_vector_alloc }, - { "time.now", fl_time_now }, - { "rand", fl_rand }, { "rand.uint32", fl_rand32 }, { "rand.uint64", fl_rand64 }, diff --git a/c/time_unix.c b/c/time_unix.c index 6e0921f..f54c881 100644 --- a/c/time_unix.c +++ b/c/time_unix.c @@ -28,14 +28,6 @@ uint64_t i64time(void) return a; } -double clock_now(void) -{ - struct timeval now; - - gettimeofday(&now, NULL); - return tv2float(&now); -} - void sleep_ms(int ms) { struct timeval timeout; @@ -57,23 +49,3 @@ void timeparts(int32_t *buf, double t) tm.tm_year += 1900; memcpy(buf, (char *)&tm, sizeof(struct tm)); } - -double parsetime(const char *str) -{ - char *fmt = "%c"; /* needed to suppress GCC warning */ - char *res; - time_t t; - struct tm tm; - - res = strptime(str, fmt, &tm); - if (res != NULL) { - tm.tm_isdst = - -1; /* Not set by strptime(); tells mktime() to determine - whether daylight saving time is in effect */ - t = mktime(&tm); - if (t == ((time_t)-1)) - return -1; - return (double)t; - } - return -1; -} diff --git a/c/time_windows.c b/c/time_windows.c index 3595e06..6ad2917 100644 --- a/c/time_windows.c +++ b/c/time_windows.c @@ -10,14 +10,6 @@ double tvals2float(struct tm *t, struct timeb *tstruct) } #endif -double floattime(void) -{ - struct timeb tstruct; - - ftime(&tstruct); - return (double)tstruct.time + (double)tstruct.millitm / 1.0e3; -} - uint64_t i64time(void) { uint64_t a; @@ -28,8 +20,6 @@ uint64_t i64time(void) return a; } -double clock_now(void) { return floattime(); } - void sleep_ms(int ms) { if (ms == 0) { diff --git a/c/timefuncs.h b/c/timefuncs.h index c4b8a48..8142a25 100644 --- a/c/timefuncs.h +++ b/c/timefuncs.h @@ -1,5 +1,3 @@ uint64_t i64time(); -double clock_now(); -double parsetime(const char *str); void sleep_ms(int ms); void timeparts(int32_t *buf, double t);