title: Logging duration of store procedure in milliseconds in mysql
body: <p>I am trying to log the duration of a procedure in MILLISECONDS. 
  The below statement worked in SQL Server fine.</p>
  
  <pre><code> /* Log the duration of this procedure */
          @DurationMillisecs INT,
          @StartTime = GETDATE(),
          SET @DurationMillisecs = DATEDIFF(millisecond, @StartTime, GETDATE())
  </code></pre>
  
  <p>I am now trying to do this in MySQL, after some research i tried the below method but they are returning the same value as each other. So i am guessing UNIX_TIMESTAMP doesn't calculate in milliseconds.</p>
  
  <pre><code>SET StartTime =  UNIX_TIMESTAMP();
  SET DurationMillisecs =  UNIX_TIMESTAMP() - StartTime;
  SELECT DurationMillisecs;
  </code></pre>
  
  <p>I have also tried below but the same problem.</p>
  
  <pre><code>SET StartTime =  now();
  SET DurationMillisecs = DATEDIFF( StartTime, now());
  </code></pre>
  
  <p>Thanks for any help.</p>