mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +02:00
fix stime patch for HAVE_TIMES removal
* libguile/stime.c (scm_init_stime): Fix previous patch. At this point in the source, we definitely have a run-time function, but don't necessarily have a real-time function.
This commit is contained in:
parent
32cec09d13
commit
40e2a31d87
1 changed files with 14 additions and 3 deletions
|
@ -181,6 +181,14 @@ get_internal_run_time_times (void)
|
|||
* TIME_UNITS_PER_SECOND / ticks_per_second;
|
||||
}
|
||||
|
||||
static timet fallback_real_time_base;
|
||||
static long
|
||||
get_internal_real_time_fallback (void)
|
||||
{
|
||||
return time_from_seconds_and_nanoseconds
|
||||
((long) time (NULL) - fallback_real_time_base, 0);
|
||||
}
|
||||
|
||||
|
||||
SCM_DEFINE (scm_get_internal_real_time, "get-internal-real-time", 0, 0, 0,
|
||||
(),
|
||||
|
@ -865,9 +873,12 @@ scm_init_stime()
|
|||
if (!get_internal_run_time)
|
||||
get_internal_run_time = get_internal_run_time_times;
|
||||
|
||||
/* If we don't have a run-time timer, use real-time. */
|
||||
if (!get_internal_run_time)
|
||||
get_internal_run_time = get_internal_real_time;
|
||||
if (!get_internal_real_time)
|
||||
/* No POSIX timers, gettimeofday doesn't work... badness! */
|
||||
{
|
||||
fallback_real_time_base = time (NULL);
|
||||
get_internal_real_time = get_internal_real_time_fallback;
|
||||
}
|
||||
|
||||
scm_add_feature ("current-time");
|
||||
#include "libguile/stime.x"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue