fromFileTime
Signature
Section titled “Signature”fromFileTime(value: bigint): stringConvert a Windows FILETIME back to an ISO 8601 instant string.
valuecounts 100-nanosecond intervals since 1601-01-01T00:00:00Z.- The accepted range is
0nto2^63 − 1, 1601-01-01 to+030828-09-14T02:48:05.4775807Z.FILETIMEis a pair ofDWORDs, so a negative value is rejected rather than read as a pre-1601 instant. Values from2^63up are rejected too: Microsoft’sFileTimeToSystemTimerequires a value “less than 0x8000000000000000”, andSetFileTimeuses0xFFFFFFFFFFFFFFFF(2^64 − 1) as its “do not modify” marker. - To decode the raw unsigned count anyway, for example to inspect a marker, compute
fromNanoseconds((value - 116444736000000000n) * 100n). - Exact in this direction — 100 ns is coarser than the nanoseconds an ISO string carries, so nothing is rounded. The loss, if any, happened in
toFileTime. - Returns "" on invalid input.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value | bigint | 100-nanosecond intervals since 1601-01-01 (bigint, 0n to 2^63 − 1) |
Returns
Section titled “Returns”ISO 8601 instant string (UTC), or "" on invalid input
Examples
Section titled “Examples”import { fromFileTime } from "@northguild/gmt/precision/convert";
fromFileTime(0n) // "1601-01-01T00:00:00Z" — the FILETIME epoch