T
Size: a a a
T
T
const byteToHex = [];
for (let i = 0; i < 256; ++i) {
byteToHex.push((i + 0x100).toString(16).substr(1).toLowerCase());
}
const mapHex = (block = []) => block.map(x => byteToHex[x]).join("")
function v1_simplified(msecs = Date.now()) {
msecs += 12219292800000;
const tl = ((msecs & 0xfffffff) * 10000) % 0x100000000;
const tmh = ((msecs / 0x100000000) * 10000) & 0xfffffff;
const A = [ (tl >>> 24) & 0xff, (tl >>> 16) & 0xff, (tl >>> 8) & 0xff, tl & 0xff ]
const B = [ (tmh >>> 8) & 0xff, tmh & 0xff ]
const C = [ ((tmh >>> 24) & 0xf)| 0x10, (tmh >>> 16) & 0xff ]
return `${mapHex(A)}-${mapHex(B)}-${mapHex(C)}-8000-000000000000`;
}
console.log(v1_simplified(Date.parse('04 Dec 1995 00:12:00 GMT')))
// 5fc18800-2dd0-11cf-8000-000000000000
T
function v1_simplified(msecs = Date.now()) {
msecs += 12219292800000;
const tl = ((msecs & 0xfffffff) * 10000) % 0x100000000;
const th = ((msecs / 0x100000000) * 10000) & 0xfffffff;
const tl_string = tl.toString(16).padStart(8, "0")
const th_string1 = th.toString(16).padStart(8, "0").slice(1, 4)
const th_string2 = th.toString(16).padStart(8, "0").slice(4, 8)
return `${tl_string}-${th_string2}-1${th_string1}-8000-000000000000`;
}
console.log(v1_simplified(Date.parse('04 Dec 1995 00:12:00 GMT')))
// 5fc18800-2dd0-11cf-8000-000000000000
T
T
T
function v1_simplified(msecs = Date.now()) {
msecs += 12219292800000;
const str = (msecs*10000).toString(16).padStart(15, "0")
return `${str.slice(7)}-${str.slice(3, 7)}-1${str.slice(0, 3)}-8000-000000000000`;
}
console.log(v1_simplified(Date.parse('04 Dec 1995 00:12:00 GMT')))
// 5fc18800-2dd0-11cf-8000-000000000000
T
🔘
🔘
T
T
T
🔘
T
🔘
T
T
🔘
🔘
🔘