-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathgetTime.js
26 lines (26 loc) · 951 Bytes
/
getTime.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/node
/* getTime.js uses node to generate a recent timestamp and
* ISODate formatted string of the same time. You can then
* copy these values into the `timestamp` and `isodate` fields
* in snooty.toml to ensure that examples for commands like
* replSetGetStatus show recent dates and times.
*
* To use, run the file with Node.js:
*
* $ node bin/getTime.js
* Update the following lines in snooty.toml:
* timestamp = "Timestamp(1723762902, 1)"
* isodate = "ISODate(\"2024-08-15T23:01:42.773Z\")
*
* Then, copy the return values into snooty.toml.
*
* Author: Kenneth P. J. Dyer <[email protected]>
* Created: 2024-08-15
* Updated:
*/
const n = new Date();
const t = Math.floor(n / 1000);
const d = n.toISOString();
console.log("Update the following lines in snooty.toml:");
console.log("timestamp = \"Timestamp(%d, 1)\"", t);
console.log("isodate = \"ISODate(\\\"%s\\\")\"", d);