Changeset 10822


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.

Location:
trunk/source/level-1
Files:
3 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 ()
  • trunk/source/level-1/l1-streams.lisp

    r10706 r10822  
    53125312    (let* ((wait-end
    53135313            (when timeout
    5314               (#_gettimeofday now (%null-ptr))
     5314              (gettimeofday now)
    53155315              (+ (timeval->milliseconds now) timeout))))
    53165316      (loop
     
    53285328            (return (values nil nil error)))
    53295329          (when timeout
    5330             (#_gettimeofday now (%null-ptr))
     5330            (gettimeofday now)
    53315331            (setq timeout (- wait-end (timeval->milliseconds now)))
    53325332            (if (<= timeout 0)
     
    53475347    (let* ((wait-end
    53485348            (when timeout
    5349               (#_gettimeofday now (%null-ptr))
     5349              (gettimeofday now)
    53505350              (+ (timeval->milliseconds now) timeout))))
    53515351      (loop
     
    53635363          ;; If there was no timeout, continue to wait forever.
    53645364          (when timeout
    5365             (#_gettimeofday now (%null-ptr))
     5365            (gettimeofday now)
    53665366            (setq timeout (- wait-end (timeval->milliseconds now)))
    53675367            (if (<= timeout 0)
  • trunk/source/level-1/linux-files.lisp

    r10707 r10822  
    18141814;;(assert (= (logcount *host-page-size*) 1))
    18151815
     1816(defun get-universal-time ()
     1817  "Return a single integer for the current time of
     1818   day in universal time format."
     1819  (rlet ((tv :timeval))
     1820    (gettimeofday tv)
     1821    (+ (pref tv :timeval.tv_sec) unix-to-universal-time)))
     1822
    18161823#-windows-target
    18171824(progn
Note: See TracChangeset for help on using the changeset viewer.