title: How to tell if current time is the exact same as timestamp right down to the millisecond?
body: <p>I am sending a timestamp from the server and I want the browser to know when that exact time is.</p>
  
  <p>I am using Moment but feel there are a few ways to achieve this.</p>
  
  <p>I have looked at using <code>isSame()</code> in a <code>setInterval()</code> but it doesn't seem to be working.</p>
  
  <pre><code>var interval = setInterval(function(){
  
      if(moment().isSame(moment(data.server_time_stamp))){
          console.log('MATCHES!!!')
          clearInterval(interval)
      }
  
  }, 1)
  </code></pre>
  
  <p>Where <code>data.server_time_stamp</code> is a moment object passed from the server (Calculated as current time + 10 seconds). I have set this to <code>utc()</code> in order to standardize the timezones on server and client. </p>
  
  <p>I have also tried setting it to <code>unix()</code> and in my <code>setInterval()</code> loop, using <code>===</code> operator to see if they are the same. Like so:</p>
  
  <pre><code>var interval = setInterval(function(){
  
    if(cur_time === data.screenshot_time){
     console.log('MATCHES!!!')
     clearInterval(interval)
    }
  
  }, 1)
  </code></pre>
  
  <p>all though  with this method, it doesn't seem to be acurate enough.</p>
  
  <p>What is the most accurate way to messure this?</p>