Ignore:
Timestamp:
Sep 22, 2008, 12:25:45 PM (11 years ago)
Author:
gb
Message:

Define GETTIMEOFDAY, which calls lisp_gettimeofday() in the kernel.
(gettimeofday() is prototyped in the mingw headers on Windows but
only available as statically linked code). Change other uses of
#_gettimeofday to call the GETTIMEOFDAY function. Remove some
Windows-specific code that was avoiding use of #_gettimeofday.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/level-1/l1-lisp-threads.lisp

    r10632 r10822  
    7373     (round (pref tv :timeval.tv_usec) (floor 1000000 *ticks-per-second*))))
    7474
    75 #-windows-target
     75
     76(defun gettimeofday (ptimeval &optional (ptz +null-ptr+))
     77  (int-errno-ffcall (%kernel-import target::kernel-import-lisp-gettimeofday)
     78                    :address ptimeval
     79                    :address ptz
     80                    :int))
     81
    7682(defloadvar *lisp-start-timeval*
    7783    (progn
    7884      (let* ((r (make-record :timeval)))
    79         (#_gettimeofday r (%null-ptr))
     85        (gettimeofday r +null-ptr+)
    8086        r)))
    8187
     
    8793  "Return the real time in the internal time format. (See
    8894  INTERNAL-TIME-UNITS-PER-SECOND.) This is useful for finding elapsed time."
    89   #-windows-target
    9095  (rlet ((tv :timeval))
    91     (#_gettimeofday tv (%null-ptr))
     96    (gettimeofday tv)
    9297    (let* ((units (truncate (the fixnum (pref tv :timeval.tv_usec)) (/ 1000000 internal-time-units-per-second)))
    9398           (initial *internal-real-time-session-seconds*))
     
    103108          (setq *internal-real-time-session-seconds*
    104109                (pref tv :timeval.tv_sec))
    105           units))))
    106   #+windows-target
    107   (rlet ((ft #>FILETIME))
    108     (#_GetSystemTimeAsFileTime ft)
    109     (values
    110      (floor (dpb (pref ft #>FILETIME.dwHighDateTime) (byte 32 32)
    111                 (pref ft #>FILETIME.dwLowDateTime))
    112            (floor 10000000 internal-time-units-per-second)))))
     110          units)))))
    113111
    114112(defun get-tick-count ()
Note: See TracChangeset for help on using the changeset viewer.