Discuss Scratch
- Discussion Forums
- » Suggestions
- » Current Millisecond,Microsecond and Nanosecond
- pac_man_project_
-
1 post
Current Millisecond,Microsecond and Nanosecond
I think that a current millisecond should be added, because I've made a date and time and it was annoying to do the milliseconds, even though it's possible.
- MagicCoder330
-
1000+ posts
Current Millisecond,Microsecond and Nanosecond
a wild necropost has appeared.
This topic is old and discussion has stopped, please don't post here unless you have something to add that isn't just support/no support.
This topic is old and discussion has stopped, please don't post here unless you have something to add that isn't just support/no support.
- BigNate469
-
1000+ posts
Current Millisecond,Microsecond and Nanosecond
While I would like to see current millisecond, being able to read the current microsecond (from a webpage) can depend on your OS, browser, and/or CPU. Additionally, the days since 2000 block is precise enough to, with some math, give the current millisecond.
While any CPU that can run at >=1 GHz can theoretically keep time in nanoseconds, your computer also has to run your browser, and because of this the ECMAScript specification does not provide a way to measure nanoseconds.
Besides, there's not much you could be doing on Scratch that would require nanosecond measurements.
See Also:
https://developer.mozilla.org/en-US/docs/Web/API/Performance/now
While any CPU that can run at >=1 GHz can theoretically keep time in nanoseconds, your computer also has to run your browser, and because of this the ECMAScript specification does not provide a way to measure nanoseconds.
Besides, there's not much you could be doing on Scratch that would require nanosecond measurements.
See Also:
https://developer.mozilla.org/en-US/docs/Web/API/Performance/now
- imfh
-
1000+ posts
Current Millisecond,Microsecond and Nanosecond
Actually, now I can think of a reason to want microseconds. It might be useful if you want to seed a random number generator, but you could just use the random block or other entropy so it's not that important. Your browser doesn't let webpages get the current nano second for security reasons. I also can't think of any reason to need the current micro second. You can, however, get milliseconds using the days since 2000 block which has high precision.
24 hours * 60 minutes * 60 seconds * 1000 miliseconds = 86,400,000 = 86.4*10^6 = 86.4e6((days since 2000) * (86.4e6)) // milliseconds since 2000
- Discussion Forums
- » Suggestions
-
» Current Millisecond,Microsecond and Nanosecond