1
0
mirror of synced 2025-02-21 20:40:24 +01:00

Completion of simple filetime conversion

This commit is contained in:
Bwhit1 2017-06-11 20:05:30 -04:00
parent 003e076b00
commit ae38bb0927
2 changed files with 10 additions and 5 deletions

View File

@ -2268,7 +2268,7 @@ const OperationConfig = {
outputType: "string", outputType: "string",
args: [ args: [
{ {
name: "Units", name: "Output Units",
type: "Option", type: "Option",
value: DateTime.UNITS value: DateTime.UNITS
} }
@ -2281,7 +2281,7 @@ const OperationConfig = {
outputType: "string", outputType: "string",
args: [ args: [
{ {
name: "Units", name: "Input Units",
type: "Option", type: "Option",
value: DateTime.UNITS value: DateTime.UNITS
} }

View File

@ -1,5 +1,3 @@
//import Decimal from "../lib/decimal.min.js";
import Utils from "../Utils.js";
import {BigInteger} from "jsbn"; import {BigInteger} from "jsbn";
/** /**
@ -82,6 +80,13 @@ const DateTime = {
}, },
/**
*@constant
*@default
*/
RADIX: ["Decimal", "Hex"],
/** /**
* Converts a Windows FILETIME to Unix Epoch time. * Converts a Windows FILETIME to Unix Epoch time.
* *
@ -92,7 +97,7 @@ const DateTime = {
*/ */
runFromFiletimeToUnix: function(input, args) { runFromFiletimeToUnix: function(input, args) {
let units = args[0], offset = new BigInteger("116444736000000000"); let units = args[0], offset = new BigInteger("116444736000000000");
input = new BigInteger(input,16).subtract(offset); input = new BigInteger(input).subtract(offset);
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)") {