Can I get more accurate time than new Date()->getTime() in node.js

Showing 1-13 of 13 messages
Can I get more accurate time than new Date()->getTime() in node.js xiongjiabin 3/4/12 9:57 PM


--
Hello,World!
熊佳斌(totty)
Re: Can I get more accurate time than new Date()->getTime() in node.js xiongjiabin 3/5/12 4:12 AM
Can get micro time via  this module . https://github.com/wadey/node-microtime 
works fine.


On Mon, Mar 5, 2012 at 1:57 PM, jiabin xiong <totty...@gmail.com> wrote:


--
Hello,World!
熊佳斌(totty)



--
Hello,World!
熊佳斌(totty)
Re: Can I get more accurate time than new Date()->getTime() in node.js Bert Belder 3/5/12 4:37 AM
Creating an addon that provides an uv_hrtime() binding would be a good
cross-platform solution for this.
Re: [nodejs] Re: Can I get more accurate time than new Date()->getTime() in node.js Ben Noordhuis 3/5/12 5:51 AM
On Mon, Mar 5, 2012 at 13:37, Bert Belder <bertb...@gmail.com> wrote:
> Creating an addon that provides an uv_hrtime() binding would be a good
> cross-platform solution for this.

I don't mind adding a `process.hrtime()` function, it would be useful
for benchmarks. The problem is that uv_hrtime() returns a 64 bits
unsigned integer, while JS numbers only have 53 bits of precision.

Re: [nodejs] Re: Can I get more accurate time than new Date()->getTime() in node.js Dean Landolt 3/5/12 6:32 AM


But a tuple of 2 JS numbers has 106. This wouldn't be the prettiest API but it would get the job done.
Re: [nodejs] Re: Can I get more accurate time than new Date()->getTime() in node.js Micheil Smith 3/5/12 6:43 AM
Yeah, you could do something like [seconds, microseconds], such that you
could have precision on your values.

– Micheil

> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to nod...@googlegroups.com
> To unsubscribe from this group, send email to
> nodejs+un...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en

Re: [nodejs] Re: Can I get more accurate time than new Date()->getTime() in node.js Matt Sergeant 3/5/12 6:46 AM
Alternatively, maybe just not worry about it, since 2**53 microseconds isn't hit until 2255. I hope to not be using Node then :-)
Re: [nodejs] Re: Can I get more accurate time than new Date()->getTime() in node.js Dean Landolt 3/5/12 6:51 AM


On Mon, Mar 5, 2012 at 9:46 AM, Matt <hel...@gmail.com> wrote:
Alternatively, maybe just not worry about it, since 2**53 microseconds isn't hit until 2255. I hope to not be using Node then :-)

Heh. I like Matt's idea better :)
Re: [nodejs] Re: Can I get more accurate time than new Date()->getTime() in node.js Ben Noordhuis 3/5/12 7:15 AM

uv_hrtime() has nanosecond resolution and it's not necessarily a
timestamp, just an arbitrary monotonically increasing counter. But
yes, a tuple would work. Anyone feel like doing a pull request?

Re: [nodejs] Re: Can I get more accurate time than new Date()->getTime() in node.js Jorge 3/5/12 7:26 AM

You could return it % 2^53: 2^53*1e-9/60/60/24 === 104 days

Or an object: {
  mod2_53: (ts.tv_sec * NANOSEC + ts.tv_nsec) % 2^53
  sec: ts.tv_sec
  nsec: ts.tv_nsec }
--
Jorge.

Re: [nodejs] Re: Can I get more accurate time than new Date()->getTime() in node.js Nathan Rajlich 3/5/12 8:46 AM
I'm working on the patch. Up in a sec.


--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Re: [nodejs] Re: Can I get more accurate time than new Date()->getTime() in node.js Nathan Rajlich 3/5/12 9:01 AM
Re: [nodejs] Re: Can I get more accurate time than new Date()->getTime() in node.js billywhizz 3/5/12 9:12 AM
*applause*