Closed ryandesign closed 1 year ago
I wonder why it fails... glock_gettime
is POSIX since 2001, and its declaration should be in time.h
, which system.c
includes. (?)
macOS 10.12 (2016) is the earliest version of macOS that includes clock_gettime
.
@ryandesign Does pre-10.12 have some equivalent of CLOCK_MONOTONIC
?
CLOCK_REALTIME
is basically the layman's notion of "current time", right?
MacPorts has a "legacy support" library that backports functions available in newer operating systems like clock_gettime
to older OS versions. I can include that library in the STklos ports to probably fix the problem, but that only helps users installing STklos via MacPorts, not those building from source or other methods.
You could include compatibility implementations of such functions in the STklos codebase and use them when the OS doesn't have them. MacPorts legacy support is open source but each function seems to have its own origin with its own license so if you wanted to copy it you'd have to evaluate whether its license is compatible. Here's the code for clock_gettime
. See also a pull request for an improvement to it.
Looks like good code under te ISC license. Maybe it should be added to the SRFI 170 repo where others would find it as well.
I have added a test in autoconf for clock_gettime
, and simulated it for CLOCK_REALTIME
only. This implies that the function monotonic-time
will yield an error on such systems. I have not added the code given by @ryandesign, because it is too macOS specific, and the number of impacted persons should be low.
Thanks for signaling the problem.
stklos 1.70 and git master fail to build on older versions of macOS:
Here is a full build log from OS X 10.11: https://build.macports.org/builders/ports-10.11_x86_64-builder/builds/214665/steps/install-port/logs/stdio
Can system.c survive without
clock_gettime
? If so, you probably want a configure test to check if it exists before you use it in system.c and elsewhere.