-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Make get-internal-real-time monotonic #46
base: master
Are you sure you want to change the base?
Conversation
On Darwin it now correctly returns a value in ns, see https://developer.apple.com/library/content/qa/qa1398/_index.html On Windws it now correctly returns a monotinic value
level-1/l1-lisp-threads.lisp
Outdated
@@ -33,8 +33,17 @@ | |||
#-windows-target | |||
(max 1000 (#_sysconf #$_SC_CLK_TCK))) | |||
|
|||
(defloadvar *ns-per-second* | |||
1000000000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a job for defconstant.
level-1/l1-lisp-threads.lisp
Outdated
1000000000) | ||
|
||
(defloadvar *ns-per-millisecond* | ||
(floor *ns-per-second* 1000)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also defconstant.
For the record, I believe the reason that we saved the initial seconds value from gettimeofday was so that operations on internal time unit values would likely be fixnum operations. It's definitely more correct to use If we use We might also have to generate new Windows headers so that the |
Note that only on Windows this |
I also thought about fixnums with regard to
I am temped to ignore the six days of fixnums on 32bit CCL because it’s an easily imaginable run time of a program. Since we are getting time in nanoseconds here anyways, the 36 year mark applies indirectly through |
*ns-per-second* → +ns-per-second+ *ns-per-millisecond* → +ns-per-millisecond+
See Also: #20
This work-in-progress PR moves
ccl:current-time-in-nanoseconds
from lib/time to l1-lisp-threads, and uses it to implementget-internal-real-time
andccl::get-tick-count
.The previous implementation of
get-internal-real-time
remembered the initial seconds value and subtracted it from values before returning them. I.e. the values returned byget-internal-real-time
would be close to zero after starting CCL. The new implementation does no such thing, the value returned is relative to system boot time.Additionally it changes
ccl:current-time-in-nanoseconds
toCould anyone on Windows/Darwin test these changes? I remember Microsoft to provide virtual machine images for testing, but I doubt they include a C compiler? Anyway, this should print as shown below: