Merge branch 'bwhitn-filetimemod'
This commit is contained in:
commit
48d45d026e
@ -2301,6 +2301,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
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -2314,6 +2319,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
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -89,8 +89,17 @@ const DateTime = {
|
|||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
runFromFiletimeToUnix: function(input, args) {
|
runFromFiletimeToUnix: function(input, args) {
|
||||||
let units = args[0];
|
let units = args[0],
|
||||||
input = new BigInteger(input).subtract(new BigInteger("116444736000000000"));
|
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)") {
|
||||||
@ -102,6 +111,7 @@ const DateTime = {
|
|||||||
} else {
|
} else {
|
||||||
throw "Unrecognised unit";
|
throw "Unrecognised unit";
|
||||||
}
|
}
|
||||||
|
|
||||||
return input.toString();
|
return input.toString();
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -115,8 +125,11 @@ const DateTime = {
|
|||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
runToFiletimeFromUnix: function(input, args) {
|
runToFiletimeFromUnix: function(input, args) {
|
||||||
let units = args[0];
|
let units = args[0],
|
||||||
|
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"));
|
||||||
} else if (units === "Milliseconds (ms)") {
|
} else if (units === "Milliseconds (ms)") {
|
||||||
@ -128,10 +141,24 @@ 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
|
||||||
|
@ -16,7 +16,7 @@ TestRegister.addTests([
|
|||||||
recipeConfig: [
|
recipeConfig: [
|
||||||
{
|
{
|
||||||
op: "Windows Filetime to UNIX Timestamp",
|
op: "Windows Filetime to UNIX Timestamp",
|
||||||
args: ["Nanoseconds (ns)"],
|
args: ["Nanoseconds (ns)", "Decimal"],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@ -27,7 +27,7 @@ TestRegister.addTests([
|
|||||||
recipeConfig: [
|
recipeConfig: [
|
||||||
{
|
{
|
||||||
op: "UNIX Timestamp to Windows Filetime",
|
op: "UNIX Timestamp to Windows Filetime",
|
||||||
args: ["Nanoseconds (ns)"],
|
args: ["Nanoseconds (ns)", "Decimal"],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user