anchor.diff:      (with-foreign-slots ((sec usec) tv timeval)
         (%%sys-gettimeofday tv (null-pointer))
         (values sec usec))))
  +
  +#-darwin
  +(progn
  +  (defsyscall (%%sys-clock-getres "clock_getres") :int
  +    "Returns the resolution of the clock CLOCKID."
  +    (clockid clockid-t)
  +    (res     :pointer))
  +
  +  (defentrypoint %sys-clock-getres (clock-id)
  +    (with-foreign-object (ts 'timespec)
  +      (with-foreign-slots ((sec nsec) ts timespec)
  +        (%%sys-clock-getres clock-id ts)
  +        (values sec nsec))))
  +
  +  (defsyscall (%%sys-clock-gettime "clock_gettime") :int
  +    (clockid clockid-t)
  +    (tp      :pointer))
  +
  +  (defentrypoint %sys-clock-gettime (clock-id)
  +    "Returns the time of the clock CLOCKID."
  +    (with-foreign-object (ts 'timespec)
  +      (with-foreign-slots ((sec nsec) ts timespec)
  +        (%%sys-clock-gettime clock-id ts)
  +        (values sec nsec))))
  +
  +  (defsyscall (%%sys-clock-settime "clock_settime") :int
  +    (clockid clockid-t)
  +    (tp      :pointer))
  +
  +  (defentrypoint %sys-clock-settime (clock-id)
  +    "Sets the time of the clock CLOCKID."
  +    (with-foreign-object (ts 'timespec)
  +      (with-foreign-slots ((sec nsec) ts timespec)
  +        (%%sys-clock-settime clock-id ts)
  +        (values sec nsec)))))
   
   ;;; FIXME: or we can implement this through the MACH functions.
   #+darwin
  
positive.code: ;;;-------------------------------------------------------------------------
  
  (defsyscall* (%sys-usleep "usleep") :int
    (useconds useconds-t))
  
  (defsyscall (%%sys-time "time") time-t
    (tloc :pointer))
  
  (defentrypoint %sys-time ()
    (%%sys-time (null-pointer)))
  
  (defsyscall (%%sys-gettimeofday "gettimeofday") :int
  
negative.code:     (make-instance 'stat :pointer buf)))
  
  (defentrypoint %sys-stat (path)
    "Get information about file PATH(dereferences symlinks)."
    (funcall-stat #'%%sys-stat path))
  
  (defentrypoint %sys-fstat (fd)
    "Get information about file descriptor FD."
    (funcall-stat #'%%sys-fstat fd))
  
  (defentrypoint %sys-lstat (path)
    "Get information about file PATH(does not dereference symlinks)."
    (funcall-stat #'%%sys-lstat path))
  
  (defsyscall (%sys-sync "sync") :void
    "Schedule all file system buffers to be written to disk.")
  
  (defsyscall* (%sys-fsync "fsync") :int
    "Schedule a file's buffers to be written to disk."
    (fildes :int))
  
  (defsyscall (%%sys-mkstemp "mkstemp") :int
    (template filename-designator))
  
  (defentrypoint %sys-mkstemp (&optional (template ""))
    "Generate a unique temporary filename from TEMPLATE."
    (let ((template (concatenate 'string template "XXXXXX")))
      (with-foreign-string (ptr (filename template))
        (values (%%sys-mkstemp ptr) (foreign-string-to-lisp ptr)))))
  