scm_c_get_internal_run_time is more precise
authorAndy Wingo <wingo@pobox.com>
Wed, 4 May 2011 18:15:23 +0000 (20:15 +0200)
committerAndy Wingo <wingo@pobox.com>
Wed, 4 May 2011 18:19:11 +0000 (20:19 +0200)
commit4a42658f6a49d17cd07919bc4632ae3bddae33e5
tree920f378b1e5a83d1621efaf6783bf3cb0a4f41f9
parente3b8bce8f4fb5adf93e42bfa3263f7368ad4a3be
scm_c_get_internal_run_time is more precise

* libguile/stime.h (SCM_TIME_UNITS_PER_SECOND): Redefine to point to a C
  variable instead of being a pure preprocessor thing.  This has the
  possibility to break existing compiled C extensions' interpretation of
  the internal-time-units-per-second, but hopefully there's no too much
  of that code out there, and in the worst case they can just
  recompile.  Scheme code will get it right without the need to
  recompile.

* libguile/stime.c (TIME_UNITS_PER_SECOND): New local define, and
  increase to nanosecond resolution if we are on a system in which this
  is useful and practical.
  (time_from_seconds_and_nanoseconds): New helper.
  (get_internal_real_time, get_internal_run_time): New global vars:
  function pointers.
  (get_internal_real_time_posix_timer):
  (get_internal_run_time_posix_timer):
  (get_internal_real_time_gettimeofday):
  (get_internal_run_time_times):
  (get_internal_real_time_fallback): Various implementations.
  (scm_get_internal_real_time): Return the get_internal_real_time()
  result.
  (scm_c_get_internal_run_time): Likewise.
  (scm_gettimeofday): No need for a critical section, and remove
  obsolete ftime block.
  (scm_init_stime): Init all of the new time bases, and decide on
  implementations of real time and run time accessors.
libguile/stime.c
libguile/stime.h