_______________________________________________ Armedbear-devel mailing list Armedbear-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/armedbear-devel
bonasso bonasso@traclabs.com writes:
The RAPs system I'm running in abcl makes extensive use of the difference between two sequential get-internal-real-time calls. But I get significantly different results in abcl than in acl.
Here's an example:
In acl:
CL-USER(24): (setf foo (/ (get-internal-real-time)(float internal-time-units-per-second))) 8212185.5 CL-USER(25): (setf bar (/ (get-internal-real-time)(float internal-time-units-per-second))) 8212195.0 CL-USER(26): (- bar foo) 9.5 ;; nine+ seconds
In abcl: CL-USER(15): (setf foo (/ (get-internal-real-time)(float internal-time-units-per-second))) 1.40157018E9 CL-USER(16): (setf bar (/ (get-internal-real-time)(float internal-time-units-per-second))) 1.40157018E9 CL-USER(17): (- bar foo) 0.0 ;; 0 seconds
Thus, lots of time has to elapse between the calls before any difference is produced. (/ (get-internal-real-time)(float internal-time-units-per-second)) is the primitive time call used in the RAPs system.
Of course the first thing I noticed is that the single floats in acl don't have the E notation. Is there a setting in abcl I can use to get the same behavior as in acl, or is there another problem going on?
(get-internal-real-time) => 1401731099641, that's too big to be represented precisely as a single float. double float will work better. And better divide by internal-time-units-per-second before doing division. Even better would be to avoid converting into floats.
_______________________________________________ Armedbear-devel mailing list Armedbear-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/armedbear-devel
bonasso bonasso@traclabs.com writes:
I solved this by coercing (get-internal-real-time) into a double float.
Looks like the epoch start time for these functions is different from lisp to lisp.
ACL: (get-internal-real-time) => 8456209511 ABCL: (get-internal-real-time) => 1401814359707
Does anyone know the date from which the value for (get-internal-real-time) is computed for abcl?
Why do you need to coerce it to anything for intermediate values? Store the value returned by (get-internal-real-time), then subtract it from another (get-internal-real-time), only then divide it by internal-time-units-per-second, and only then, if you need to, convert that into floats, for printing or something. That way you will lose minimal precision.
_______________________________________________ Armedbear-devel mailing list Armedbear-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/armedbear-devel
armedbear-devel@common-lisp.net