endoscopic
This commit is contained in:
parent
e92a2a00b8
commit
c1e6bb4abb
2 changed files with 10 additions and 8 deletions
|
@ -22,9 +22,10 @@
|
|||
"Returns a fixed-point 64 bit NTP-style timetag, where the top 32
|
||||
bits represent seconds since midnight 19000101, and the bottom 32 bits
|
||||
represent the fractional parts of a second."
|
||||
(multiple-value-bind (secs usecs)
|
||||
(sb-ext:get-time-of-day)
|
||||
(the timetag (unix-secs+usecs->timetag secs usecs))))
|
||||
#+sbcl (multiple-value-bind (secs usecs)
|
||||
(sb-ext:get-time-of-day)
|
||||
(the timetag (unix-secs+usecs->timetag secs usecs)))
|
||||
#-sbcl (error "Can't encode timetags using this implementation."))
|
||||
|
||||
(defun timetag+ (original seconds-offset)
|
||||
(declare (type timetag original))
|
||||
|
@ -39,9 +40,10 @@ represent the fractional parts of a second."
|
|||
(defun get-unix-time ()
|
||||
"Returns a a double-float representing real-time now in seconds,
|
||||
with microsecond precision, relative to 19700101."
|
||||
(multiple-value-bind (secs usecs)
|
||||
(sb-ext:get-time-of-day)
|
||||
(the double-float (+ secs (microseconds->subsecs usecs)))))
|
||||
#+sbcl (multiple-value-bind (secs usecs)
|
||||
(sb-ext:get-time-of-day)
|
||||
(the double-float (+ secs (microseconds->subsecs usecs))))
|
||||
#-sbcl (error "Can't encode timetags using this implementation."))
|
||||
|
||||
(defun unix-time->timetag (unix-time)
|
||||
(multiple-value-bind (secs subsecs)
|
||||
|
|
4
osc.lisp
4
osc.lisp
|
@ -341,7 +341,7 @@ with the current time use (encode-timetag :time)."
|
|||
#+openmcl (encode-int32 (CCL::SINGLE-FLOAT-BITS f))
|
||||
#+allegro (encode-int32 (multiple-value-bind (x y) (excl:single-float-to-shorts f)
|
||||
(+ (ash x 16) y)))
|
||||
#-(or sbcl cmucl openmcl allegro) (error "cant encode floats using this implementation"))
|
||||
#-(or sbcl cmucl openmcl allegro) (error "Can't encode floats using this implementation."))
|
||||
|
||||
(defun decode-float32 (s)
|
||||
"ieee754 float from a vector of 4 bytes in network byte order"
|
||||
|
@ -350,7 +350,7 @@ with the current time use (encode-timetag :time)."
|
|||
#+openmcl (CCL::HOST-SINGLE-FLOAT-FROM-UNSIGNED-BYTE-32 (decode-uint32 s))
|
||||
#+allegro (excl:shorts-to-single-float (ldb (byte 16 16) (decode-int32 s))
|
||||
(ldb (byte 16 0) (decode-int32 s)))
|
||||
#-(or sbcl cmucl openmcl allegro) (error "cant decode floats using this implementation"))
|
||||
#-(or sbcl cmucl openmcl allegro) (error "Can't decode floats using this implementation."))
|
||||
|
||||
(defmacro defint-decoder (num-of-octets &optional docstring)
|
||||
(let ((decoder-name (intern (format nil "~:@(decode-uint~)~D" (* 8 num-of-octets))))
|
||||
|
|
Loading…
Reference in a new issue