Advanced Search

Results 1 to 8 of 8

Thread: Tracking time in miliseconds: is it reliable?

  1. #1
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,156
    Thanks
    262
    Thanked 690 Times in 678 Posts

    Default Tracking time in miliseconds: is it reliable?

    For a scientific project, I need to track reaction times: how long does it take for someone to push a button? I need this to be accurate to the milisecond (or very close).

    Can Javascript do this? Is the timer within Javascript reliable 1) at the level of miliseconds, and 2) at a constant (real-world seconds) rate?
    And is there any known accuracy cutoff? (An article linked to below suggests 15ms.)

    And is there any variation by browser and/or method for tracking the time?

    To repeat: I'm interested in time elapsed between two events. I don't care at all what time it is.

    If this is a potential problem in Javascript, I'll need to find some alternative.


    I've done a bit of searching and have come across some information, but it's not entirely clear:
    http://dvolvr.davidwaterston.com/201...s-almost-here/
    http://ejohn.org/blog/accuracy-of-javascript-time/
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,156
    Thanks
    262
    Thanked 690 Times in 678 Posts

    Default

    I've had trouble getting any answers for this. For one thing, this isn't a typical use of Javascript, so it may just be that this is not the best language to use (but it's convenient for me). I'm writing this post just to follow up in case anyone else has similar questions. I'd love to hear from someone else who does know about this, if that someone exists

    I did write up a working version of my intended application, and it works smoothly. The milliseconds, as far as I can tell, are reliable to the individual ms. The reasoning: it doesn't round and there aren't any obvious patterns. But that's not entirely conclusive. It just rules out the biggest potential issues.


    It comes down to four dimensions of potential problems, I think:
    1. Consistency from trial to trial.
    2. Variability from machine to machine.
    3. Precision (decimal points).
    4. Smoothness during a given trial.

    Here's what I've found out:
    1. I have no idea. I haven't noticed any problems, but it's basically impossible to know whether key presses (as I'm using to test this) are the same, but just overall, it looks fine. I'm going to assume it's ok.

    2. I assume this is a major problem, and an article I linked to above suggests some browsers only track the time every 15ms, which is a problem as well. But for me, I actually don't need this-- I'm just running it locally. I'd suggest extensive testing if you want this to work widely on the internet.

    3. For me, using Firefox (Mac) and Chrome (PC), this seems to work fine, down to the millisecond. It doesn't go beyond that, but I get different results of, for example, "137ms" or "134ms", etc., so it looks like it's precise.

    4. Smoothness is probably negatively affected by a busy computer. But even so, I have a number of processes running and haven't noticed any problems. When I'm running this for my actual experiment (the end goal here), I'll only have this running, of course.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Nov 2013
    Location
    capecod
    Posts
    6
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    I think I have one somewhere from a very old class, will search thru my files and see if I can find it.

  4. The Following User Says Thank You to capecodlilly2 For This Useful Post:

    djr33 (11-28-2013)

  5. #4
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,629
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Quote Originally Posted by djr33
    I'm interested in time elapsed between two events. I don't care at all what time it is.
    Are these "one-off" events? Or can you repeat them ad nauseam and take an average?
    Your mention of "key presses" would seem to indicate that you only have one shot at each interval.
    We Only Torture the Folks We Don't Like (You're Probably Gonna Be Okay)
    It's a Party in the CIA

  6. The Following User Says Thank You to traq For This Useful Post:

    djr33 (11-28-2013)

  7. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,156
    Thanks
    262
    Thanked 690 Times in 678 Posts

    Default

    Hi capecodlilly2,
    I already have working code, but I am still wondering about the reliability. So if you have any info on that it would be much appreciated!

    Quote Originally Posted by traq
    Are these "one-off" events? Or can you repeat them ad nauseam and take an average?
    Your mention of "key presses" would seem to indicate that you only have one shot at each interval.
    My question is about one-off events, I suppose. I'm wondering about in the simplest case how accurate JS is.
    However, for my project I actually will have multiple events, but not exact repetitions.

    I'm building a task for testing procedural memory-- you will push a key on the keyboard corresponding to the location of a marker on the screen. Then that marker moves, and you push a different key. Repeat. There will be somewhere between 20-100 iterations every time. Over time, the user will improve (because of just getting better at the system or patterns in the movement). And I'm interested in comparing users to each other.

    So I don't really care about the exact accuracy of any individual event, but I do need the average reaction time [=time between events] to be reliably measured.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  8. #6
    Join Date
    Nov 2013
    Location
    capecod
    Posts
    6
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Oh, mine is just telling time, just a simple one, and you refresh for the exact time. Its not what you want, but I finally did find it, its really not what I remembered it to be.
    But there are so many people here who will most likely come up with something really cool for you.

  9. #7
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,629
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    @Daniel - that's what I figured (one-off events). If it were something repeatable, I was going to recommend looping+averaging …but that wouldn't be useful in this case.
    We Only Torture the Folks We Don't Like (You're Probably Gonna Be Okay)
    It's a Party in the CIA

  10. #8
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,156
    Thanks
    262
    Thanked 690 Times in 678 Posts

    Default

    capecodlilly, thanks anyway! I appreciate it.

    traq, correct. This is user input. If a single instance isn't particularly accurate that's workable, but on average I'd need it to be reliable so that it can average over their behavior, rather than averaging over JS response times.


    As I said above, this does seem accurate. I'm not entirely sure how reliable it is (and have no idea how I could check), but it looks like it's working. I'd also be hesitant to compare across machines. Luckily this will all be local for me at the moment.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Similar Threads

  1. Looking for a free and reliable ftp client
    By jass in forum Computer hardware and software
    Replies: 6
    Last Post: 06-19-2010, 05:04 PM
  2. Which eCommerce software / Shopping cart software is reliable and well ?
    By naremkim in forum Looking for such a script or service
    Replies: 6
    Last Post: 03-14-2010, 06:51 AM
  3. Recommend reliable "free audio editor"
    By joycie in forum The lounge
    Replies: 9
    Last Post: 02-26-2007, 12:48 PM
  4. Who knows of a reliable web hosting company
    By designkitt in forum The lounge
    Replies: 24
    Last Post: 07-10-2006, 11:11 PM
  5. Time Script for tracking log
    By gprimr1 in forum HTML
    Replies: 0
    Last Post: 02-24-2005, 11:13 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •