I'd like to program my own clock based on an octal numeral system. From what I've gathered, javascript is browser friendly but inaccurate at time intervals. What's a good program to code something like this? To give an example for this specific time system, there would be 64 hours in a day, 64 minutes in an hour, and 64 seconds in a minute. This would result in 1 octal second being equivalent to 0.32958984375 ISU second.
Asked
Active
Viewed 62 times
1
-
Out of curiosity, what makes JavaScript inaccurate at time intervals? I'd imagine any irregularities would have more to do with the computer/browser executing the script than anything else. – valverij Jan 08 '14 at 18:43
-
That's precisely it valverij. When reading about it, someone ran a test and found javascript is off by about .002 each second, but it probably varies by browser and the specific code involved. – jamiestroud69 Jan 08 '14 at 19:21
-
Any code that you run through a non-standardized interpreter (in this case, the browser's JavaScript engine) is going to be subject to something like that. Depending on your goals, you might be better off with a mid-to-low-level compiled language like C or C++ (the lower level, the better, if absolute accuracy is you goal). I'm sure someone with more knowledge about system times and CPU ticks will jump in here and correct me, though. If this is just a personal project or a school assignment, a scripting language like JavaScript , Python, or Ruby should be more than fine. – valverij Jan 08 '14 at 19:46
-
Also of note, when running code at intervals in JavaScript, the choice between `setInterval` and `setTimeout` can be significant. See [setTimeout or setInterval?](http://stackoverflow.com/questions/729921/settimeout-or-setinterval) – valverij Jan 08 '14 at 19:51