Allow hex and decimal format for Windows Filetime format as those are the formats they are typically represented in
This commit is contained in:
parent
213ec028b8
commit
ad25daf206
@ -2271,6 +2271,11 @@ const OperationConfig = {
|
|||||||
name: "Output units",
|
name: "Output units",
|
||||||
type: "option",
|
type: "option",
|
||||||
value: DateTime.UNITS
|
value: DateTime.UNITS
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Input Format",
|
||||||
|
type: "option",
|
||||||
|
value: DateTime.FILETIME_FORMATS
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -2284,6 +2289,11 @@ const OperationConfig = {
|
|||||||
name: "Input units",
|
name: "Input units",
|
||||||
type: "option",
|
type: "option",
|
||||||
value: DateTime.UNITS
|
value: DateTime.UNITS
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Output Format",
|
||||||
|
type: "option",
|
||||||
|
value: DateTime.FILETIME_FORMATS
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -90,7 +90,13 @@ const DateTime = {
|
|||||||
*/
|
*/
|
||||||
runFromFiletimeToUnix: function(input, args) {
|
runFromFiletimeToUnix: function(input, args) {
|
||||||
let units = args[0];
|
let units = args[0];
|
||||||
input = new BigInteger(input).subtract(new BigInteger("116444736000000000"));
|
let format = args[1];
|
||||||
|
if (format === "Hex") {
|
||||||
|
input = new BigInteger(input, 16);
|
||||||
|
} else {
|
||||||
|
input = new BigInteger(input);
|
||||||
|
}
|
||||||
|
input = input.subtract(new BigInteger("116444736000000000"));
|
||||||
if (units === "Seconds (s)"){
|
if (units === "Seconds (s)"){
|
||||||
input = input.divide(new BigInteger("10000000"));
|
input = input.divide(new BigInteger("10000000"));
|
||||||
} else if (units === "Milliseconds (ms)") {
|
} else if (units === "Milliseconds (ms)") {
|
||||||
@ -116,6 +122,7 @@ const DateTime = {
|
|||||||
*/
|
*/
|
||||||
runToFiletimeFromUnix: function(input, args) {
|
runToFiletimeFromUnix: function(input, args) {
|
||||||
let units = args[0];
|
let units = args[0];
|
||||||
|
let format = args[1];
|
||||||
input = new BigInteger(input);
|
input = new BigInteger(input);
|
||||||
if (units === "Seconds (s)"){
|
if (units === "Seconds (s)"){
|
||||||
input = input.multiply(new BigInteger("10000000"));
|
input = input.multiply(new BigInteger("10000000"));
|
||||||
@ -128,10 +135,22 @@ const DateTime = {
|
|||||||
} else {
|
} else {
|
||||||
throw "Unrecognised unit";
|
throw "Unrecognised unit";
|
||||||
}
|
}
|
||||||
return input.add(new BigInteger("116444736000000000")).toString();
|
input = input.add(new BigInteger("116444736000000000"));
|
||||||
|
if (format === "Hex"){
|
||||||
|
return input.toString(16);
|
||||||
|
} else {
|
||||||
|
return input.toString();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @constant
|
||||||
|
* @default
|
||||||
|
*/
|
||||||
|
FILETIME_FORMATS: ["Decimal", "Hex"],
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constant
|
* @constant
|
||||||
* @default
|
* @default
|
||||||
|
Loading…
Reference in New Issue
Block a user