port to new FFI

This commit is contained in:
mainzelm 2001-01-01 16:45:32 +00:00
parent df2db4631d
commit f0ffc6acaf
1 changed files with 5 additions and 19 deletions

View File

@ -12,27 +12,13 @@
#include "scheme48.h" #include "scheme48.h"
#include "../time1.h" #include "../time1.h"
/* Sux because it's dependent on 32-bitness. */ s48_value time_plus_ticks()
#define hi8(i) (((i)>>24) & 0xff)
#define lo24(i) ((i) & 0xffffff)
#define comp8_24(hi, lo) (((hi)<<24) + (lo))
s48_value time_plus_ticks(int *hi_secs, int *lo_secs,
int *hi_ticks, int *lo_ticks)
{ {
struct timeval t; struct timeval t;
struct timezone tz; struct timezone tz;
if( gettimeofday(&t, &tz) ) return s48_enter_fixnum(errno); if( gettimeofday(&t, &tz) ) s48_raise_os_error (errno);
{ long int secs = t.tv_sec; return s48_cons (s48_enter_integer (t.tv_sec),
long int ticks = t.tv_usec; s48_cons (s48_enter_integer (t.tv_usec), S48_NULL));
}
*hi_secs = hi8(secs);
*lo_secs = lo24(secs);
*hi_ticks = hi8(ticks);
*lo_ticks = lo24(ticks);
}
return S48_FALSE;
}