1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-09 21:40:33 +02:00

* stime.c (scm_get_internal_real_time): Do the arithmetic using

SCM numbers, so we won't have rollover problems; the range of a
signed long in milliseconds is about 25 days.  (Thanks to Karl
Hegbloom.)
This commit is contained in:
Jim Blandy 1998-10-13 23:56:08 +00:00
parent eebc12c634
commit 55c4d089d0

View file

@ -140,15 +140,17 @@ SCM
scm_get_internal_real_time()
{
struct timeb time_buffer;
long tmp;
ftime(&time_buffer);
SCM tmp;
ftime (&time_buffer);
time_buffer.time -= scm_your_base.time;
tmp = time_buffer.millitm - scm_your_base.millitm;
tmp = time_buffer.time*1000L + tmp;
tmp *= CLKTCK;
tmp /= 1000;
return scm_long2num (tmp);
}
tmp = scm_long2num (time_buffer.millitm - scm_your_base.millitm);
tmp = scm_sum (tmp,
scm_product (SCM_MAKINUM (1000),
SCM_MAKINUM (time_buffer.time)));
return scm_quotient (scm_product (tmp, SCM_MAKINUM (CLKTCK)),
SCM_MAKINUM (1000));
};
#else