--- stime.c.~1.79.~ 1970-01-01 10:00:00.000000000 +1000 +++ stime.c 2003-08-31 15:19:06.000000000 +1000 @@ -87,7 +87,13 @@ # endif #endif -#ifdef HAVE_FTIME + +/* times() returns a genuine real-time, meaning it's unaffected by system + time changes made by stime(). If times() isn't available (mingw for + instance) then we have to fall back on ftime() or time(). */ +#if HAVE_TIMES +clock_t scm_your_base; +#elif HAVE_FTIME struct timeb scm_your_base = {0}; #else timet scm_your_base = 0; @@ -99,7 +105,10 @@ "started.") #define FUNC_NAME s_scm_get_internal_real_time { -#ifdef HAVE_FTIME +#if HAVE_TIMES + struct tms dummy; + return scm_long2num (times (&dummy) - scm_your_base); +#elif HAVE_FTIME struct timeb time_buffer; SCM tmp; @@ -664,7 +673,13 @@ scm_c_define ("internal-time-units-per-second", scm_long2num((long) SCM_TIME_UNITS_PER_SECOND)); -#ifdef HAVE_FTIME +#if HAVE_TIMES + if (!scm_your_base) + { + struct tms dummy; + scm_your_base = times(&dummy); + } +#elif HAVE_FTIME if (!scm_your_base.time) ftime(&scm_your_base); #else if (!scm_your_base) time(&scm_your_base);