Timer - higher resolution possible?

I saw an entry on timer resolution, it reporting seconds.
@BH mentioned "current ms" allows milliseconds reporting.

Is there timer possibility with microseconds resolution, as in microBlocks ?


Is this what you want?

untitled script pic (1)

Thanks, but this is still in milliseconds.
I was asking for microseconds, but may be it is not possible due to in-browser execution speed.

Yes @tguneysu, I think it is no possible (or it has no sense). Some comments:

  • We are using Js funcions, reporting milliseconds.
  • You can see some W3C docs about high resolution time
  • But here, our latency (Snap! scheduler and also browser's own latency) makes no sense to this mesures. Another matter is MicroBlocks features, but they are about hardware programming, controlling clock speed and necessary to work with some hardware (sensors...)


Oh, sorry! I can't read I guess. Try this:

untitled script pic (1)
But the web site where I found this also says that browsers are intentionally degrading the accuracy of this technique because of some malware problem.

Hi Joan
I was also thinking about browser execution times and realised the "no sense" issue.
However, there is an upcoming microBlocks & SNAP functionality merger. And I have encountered the issue as I was trying to pass events from microBlocks to SNAP using the WebThingServer. Hence my request.

@bh, I can definitely work with that.

Interesting... We are also working with WebThings protocol. We will include it on Snap4Arduino: client blocks as a custom library (it will also run in Snap! doing the same things Mozilla gateway does) and the server side on our webserver feature (allowing Snap4Arduino projects to be also Web Things, sharing properties, actions...)

Aside this, microBlocks will always run on the devices, and Snap! on the browser. So latency problem will exist forever. Then, we can share properties (in seconds, milliseconds, microseconds...) as normal data... but reporters (that are the ones mesuring) will have different contexts. If we want to read microseconds but our measurement instrument has not that precision level, this extra info will be a random info.