Remove time.now and parsetime functions

This commit is contained in:
Lassi Kortela 2019-08-19 01:15:28 +03:00
parent 023937e5ea
commit e2dffd97fe
4 changed files with 0 additions and 52 deletions

View File

@ -2,7 +2,6 @@
Extra femtoLisp builtin functions Extra femtoLisp builtin functions
*/ */
#include <sys/time.h>
#include <sys/types.h> #include <sys/types.h>
#include <assert.h> #include <assert.h>
@ -20,8 +19,6 @@
#include "utils.h" #include "utils.h"
#include "utf8.h" #include "utf8.h"
#include "ios.h" #include "ios.h"
#include "socket.h"
#include "timefuncs.h"
#include "hashing.h" #include "hashing.h"
#include "htable.h" #include "htable.h"
#include "htableh_inc.h" #include "htableh_inc.h"
@ -336,13 +333,6 @@ static value_t fl_vector_alloc(value_t *args, uint32_t nargs)
return v; 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) static double todouble(value_t a, char *fname)
{ {
if (isfixnum(a)) if (isfixnum(a))
@ -520,8 +510,6 @@ static struct builtinspec builtin_info[] = {
{ "vector.alloc", fl_vector_alloc }, { "vector.alloc", fl_vector_alloc },
{ "time.now", fl_time_now },
{ "rand", fl_rand }, { "rand", fl_rand },
{ "rand.uint32", fl_rand32 }, { "rand.uint32", fl_rand32 },
{ "rand.uint64", fl_rand64 }, { "rand.uint64", fl_rand64 },

View File

@ -28,14 +28,6 @@ uint64_t i64time(void)
return a; return a;
} }
double clock_now(void)
{
struct timeval now;
gettimeofday(&now, NULL);
return tv2float(&now);
}
void sleep_ms(int ms) void sleep_ms(int ms)
{ {
struct timeval timeout; struct timeval timeout;
@ -57,23 +49,3 @@ void timeparts(int32_t *buf, double t)
tm.tm_year += 1900; tm.tm_year += 1900;
memcpy(buf, (char *)&tm, sizeof(struct tm)); 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;
}

View File

@ -10,14 +10,6 @@ double tvals2float(struct tm *t, struct timeb *tstruct)
} }
#endif #endif
double floattime(void)
{
struct timeb tstruct;
ftime(&tstruct);
return (double)tstruct.time + (double)tstruct.millitm / 1.0e3;
}
uint64_t i64time(void) uint64_t i64time(void)
{ {
uint64_t a; uint64_t a;
@ -28,8 +20,6 @@ uint64_t i64time(void)
return a; return a;
} }
double clock_now(void) { return floattime(); }
void sleep_ms(int ms) void sleep_ms(int ms)
{ {
if (ms == 0) { if (ms == 0) {

View File

@ -1,5 +1,3 @@
uint64_t i64time(); uint64_t i64time();
double clock_now();
double parsetime(const char *str);
void sleep_ms(int ms); void sleep_ms(int ms);
void timeparts(int32_t *buf, double t); void timeparts(int32_t *buf, double t);