UNPKG

@metamask/keyring-snap-sdk

Version:
1 lines 792 B
{"version":3,"file":"time.cjs","sourceRoot":"","sources":["../src/time.ts"],"names":[],"mappings":";;AAMA,0CAEC;AAOD,0DAEC;AAjBD;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,IAAU;IACxC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;AAC3C,CAAC;AAED;;;;GAIG;AACH,SAAgB,uBAAuB;IACrC,OAAO,eAAe,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;AACrC,CAAC","sourcesContent":["/**\n * Convert a date to its UNIX timestamp equivalent.\n *\n * @param date - The date object to convert.\n * @returns A UNIX timestamp.\n */\nexport function toUnixTimestamp(date: Date): number {\n return Math.floor(date.getTime() / 1000);\n}\n\n/**\n * Get the current UNIX timestamp.\n *\n * @returns The current UNIX timestamp.\n */\nexport function getCurrentUnixTimestamp(): number {\n return toUnixTimestamp(new Date());\n}\n"]}