1 // Copyright (c) 2014 The Chromium OS Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Convert seconds to milliseconds 6 function seconds(s) { 7 return s * 1000; 8 } 9 10 // Convert minutes to milliseconds 11 function minutes(m) { 12 return seconds(m * 60); 13 } 14 15 // returns a formatted string of current time 16 // for debugging 17 function dateToString(date) { 18 var formatting = { 19 hour: 'numeric', 20 minute: 'numeric', 21 second: 'numeric', 22 hour12: false 23 } 24 var timeString = date.toLocaleTimeString([], formatting); 25 timeString = timeString + ":" + date.getMilliseconds(); 26 return timeString 27 }