[javascript] Better way of getting time in milliseconds in javascript?