Open jasondemps1 opened 3 months ago
Please compile and post the output of:
#include<stdio.h>
#include<time.h>
#define member_size(type, member) (sizeof( ((type *)0)->member))
int main(){
printf("timespec: %lu\n", sizeof(struct timespec));
printf("timespec.secs: %lu\n", member_size(struct timespec, tv_sec));
printf("timespec.nsecs: %lu\n", member_size(struct timespec, tv_nsec));
return 0;
}
nvm that, seems macos doesn't support monotonic clock_gettime anymore... sigh.
Please try again with the latest patch and run the tests if you can.
That fix produces a fraction locally, I modified MONOTONIC-TIME-UNITS-PER-SECOND like this and it worked, but I'm not sure if the patch is safe:
(define-constant MONOTONIC-TIME-UNITS-PER-SECOND
(cffi:with-foreign-objects ((tb :uint32 2))
(if (= 0 (cffi:foreign-funcall "mach_timebase_info" :pointer tb :int))
(let ((ticks-to-nanos (floor
(/ (cffi:mem-aref tb :uint32 0)
(cffi:mem-aref tb :uint32 1)))))
(* 1000000000 ticks-to-nanos))
(error "Failed to get time scale for monotonic time."))))
better to floor after the mul
While working with Trial, I discovered this issue with
get-monotonic-time
failing each call and not exactly sure why as it's just calling out via cffi. What's odd isget-precise-time
seems to work just fine. I'm currently running on a MacBook Air M1 with SBCL 2.4.5.The full output is below: