Update FromUNIX32bitTimeStamp.mjs

This commit is contained in:
Michael H 2024-06-12 12:38:11 +01:00 committed by GitHub
parent 591b537603
commit 019f37470b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5,7 +5,6 @@
*/ */
import Operation from "../Operation.mjs"; import Operation from "../Operation.mjs";
import OperationError from "../errors/OperationError.mjs";
import moment from "moment-timezone"; import moment from "moment-timezone";
/** /**
@ -18,15 +17,12 @@ class FromUNIX32bitTimestamp extends Operation {
*/ */
constructor() { constructor() {
super(); super();
this.name = "From UNIX 32-bit Timestamp"; this.name = "From UNIX 32-bit Timestamp";
this.module = "Default"; this.module = "Default";
this.description = "Converts UNIX 32-bit Hex Timestamp to datetime string<br><br>e.g. <code>51C3C311</code> becomes <code>21 June 2013 03:05:53 UTC</code><br><br>UNIX 32-bit timestamp is a 4 Byte Hex value representing the number of seconds since January 1, 1970 UTC<br><br> Use with swap endianness recipe if required."; this.description = "Converts UNIX 32-bit Hex Timestamp to datetime string<br><br>e.g. <code>51C3C311</code> becomes <code>21 June 2013 03:05:53 UTC</code><br><br>UNIX 32-bit timestamp is a 4 Byte Hex value representing the number of seconds since January 1, 1970 UTC<br><br> Use with swap endianness recipe if required.";
this.infoURL = "https://wikipedia.org/wiki/Unix_time"; this.infoURL = "https://wikipedia.org/wiki/Unix_time";
this.inputType = "string"; this.inputType = "string";
this.outputType = "string"; this.outputType = "string";
this.args = []; this.args = [];
} }
@ -36,7 +32,6 @@ class FromUNIX32bitTimestamp extends Operation {
* @throws {OperationError} if invalid unit * @throws {OperationError} if invalid unit
*/ */
run(input, args) { run(input, args) {
const h = parseInt(input, 16); const h = parseInt(input, 16);
const d = moment.unix(h); const d = moment.unix(h);
return d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss") + " UTC"; return d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss") + " UTC";