Every line of 'millisecond timestamp' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
6 function getTimestampMilliseconds() { 7 return (new Date()).getTime(); 8 }
Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code
18 static getTimestampMilliseconds():number 19 { 20 return getTimestampMilliseconds(); 21 }
10 static getTimestampMilliseconds() { 11 return (new Date()).getTime(); 12 }
68 export function timestampFromMillis(epochMilli: number): Timestamp { 69 return { 70 seconds: Math.floor(epochMilli / MILLIS_PER_SECOND), 71 nanos: (epochMilli % MILLIS_PER_SECOND) * NANOS_PER_MILLI, 72 }; 73 }
385 function saveTimestamp (millisecond) { 386 if (timeseries.has(millisecond)) { 387 timeseries.set(millisecond, {"x": millisecond, "y": timeseries.get(millisecond).y + 1}) 388 } else { 389 timeseries.set(millisecond, {"x": millisecond, "y":1}) 390 } 391 }
104 static fromMillis(milliseconds) { 105 const seconds = Math.floor(milliseconds / 1000); 106 const nanos = (milliseconds - seconds * 1000) * MS_TO_NANOS; 107 return new Timestamp(seconds, nanos); 108 }
30 static fromMillis(milliseconds: number): Timestamp { 31 const seconds = Math.floor(milliseconds / 1000); 32 const nanos = (milliseconds - seconds * 1000) * 1e6; 33 return new Timestamp(seconds, nanos); 34 }