You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 3, 2024. It is now read-only.
nanoTime() returns integer nanoseconds, which is not directly useful. Make a common call to scale that to floating seconds and replace uses through the code.
System.nanoTime() / 1_000_000_000.0
The text was updated successfully, but these errors were encountered:
BTW for reference, "1_000_000_000.0" is not a good way to write that number. Use "engineering notation": 1.0e9. It is short, compact, and easy to read.
Also, floating division is the slowest of the simple arithmetic operations, by a fair bit. So, it is faster (and certainly no slower) to write:
1.0e-9 * System.nanoTime()
Note the minus sign in "1.0e-9". Of course, this statement is not used much in the robot code, and pretty hard to measure an actual difference. I mention it for "academic" interest.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
nanoTime() returns integer nanoseconds, which is not directly useful. Make a common call to scale that to floating seconds and replace uses through the code.
System.nanoTime() / 1_000_000_000.0
The text was updated successfully, but these errors were encountered: