What relative error bound applies to GetProcessTimes exit time versus a later precise UTC read?

박 내석 0 Reputation points
2026-11-16T10:16:28.86+00:00

I would like to clarify the documented relative timing error between a process exit time returned by GetProcessTimes and a later UTC reading returned by GetSystemTimePreciseAsFileTime

The precise UTC read occurred after the parent observed process termination through a successful wait on the process handle

That execution sequence is already established by process synchronization and the collector code

My unresolved question concerns the meaning and uncertainty of the returned timestamps and whether a documented relative error bound applies to their comparison

Recorded environment

The experiment ran in a Windows Sandbox guest

The recorded OS major version was 10 and the minor version was 0 with build 26100

The exact UBR and full kernel patch version and kernel file hash were not captured

The QPC frequency before and after capture was 10000000 Hz

Ten synthetic managed C Sharp child processes returned either 0 or 37 from Main

No native termination call stack was collected and other termination paths were not directly exercised

Observed call sequence

After starting each child process the parent obtained its handle from the corresponding Process object and retained it until evidence collection ended

The collector did not separately reopen the process by PID

The parent called WaitForSingleObject with a timeout of 10 milliseconds and recorded QPC before and after the calls

After the wait reported that the process object was signaled the parent read QPC then called GetSystemTimePreciseAsFileTime then read QPC again

The parent next called GetProcessTimes with QPC readings around that call

The parent then called GetExitCodeProcess

GetProcessTimes was therefore queried after the precise UTC read but its returned exit time refers to an earlier event

The query time is not being used as the time when the exit timestamp was recorded

In all ten preserved samples the numeric exit time was smaller than the numeric precise UTC reading

This numeric observation does not establish a maximum relative error bound or identify the exact point at which the exit timestamp was recorded

Current interpretation

The 100 nanosecond unit of FILETIME is a representation unit and is not by itself an accuracy guarantee for the process exit timestamp

The PsGetProcessExitTime documentation describes a typical system time update interval of approximately 10 milliseconds

I do not treat that description as a maximum error bound for GetProcessTimes or assume that the two APIs provide independent evidence

QPC readings around a query locate the query but do not establish the uncertainty of the historical exit timestamp

An unchanged QPC frequency and the absence of a recorded UTC adjustment do not prove that no clock adjustment or guest synchronization occurred

A child marker immediately before termination together with a parent signal observation is only a proposed candidate interval

This proposal has not been implemented or run

It would still require evidence that the exit timestamp recording point lies within that interval

Sharing QPC and system UTC does not provide independent physical clocks

Repeated queries of the same stored exit value are not treated as independent measurements

Requested clarification

Is there a documented maximum relative error bound for the GetProcessTimes exit timestamp compared with a precise UTC reading made after observing termination in the same Windows guest

Please clarify any documented definition of the exit timestamp recording point and its clock source and rounding behavior

Please state the assumptions and applicable OS builds and termination paths for any guarantee

If no such bound is documented please distinguish that from typical accuracy or behavior observed in a particular implementation

I am not deriving a tolerance from the largest observed discrepancy and I am not asking for certification of absolute UTC accuracy

I am not claiming that Windows produced an incorrect timestamp

The observed execution sequence and numeric comparison are retained while the timestamp error model remains unestablished

Official documentation consulted

GetProcessTimes

GetSystemTimePreciseAsFileTime

PsGetProcessExitTime

WaitForSingleObject

Acquiring high resolution time stamps

Windows development | Windows API - Win32
0 comments No comments

2 answers

Sort by: Most helpful
  1. Percy Nguyen (WICLOUD CORPORATION) 240 Reputation points Microsoft External Staff Moderator
    2026-11-16T11:06:52.7333333+00:00

    Hi @박 내석 ,

    Thanks for sharing your questions.

    I could not find a documented maximum relative error bound for the GetProcessTimes exit timestamp compared with a later GetSystemTimePreciseAsFileTime reading in the same Windows guest. Your successful wait establishes the execution ordering you described; the unresolved issue is the timestamp error model.

    GetProcessTimes documents the returned value as the process's exit time, represented in FILETIME units. It does not specify:

    • The exact clock-sampling or timestamp-storage point within process termination.
    • The kernel clock-reading routine or interpolation algorithm used.
    • The rounding or truncation rule.
    • A maximum error relative to a subsequent precise UTC reading.

    The 100 ns representation therefore does not establish 100 ns accuracy. PsGetProcessExitTime describes system time as typically updated approximately every ten milliseconds. That wording supplies neither a maximum exit-timestamp error nor a documented implementation relationship sufficient to transfer a bound to GetProcessTimes.

    There is a stronger related statement in the KeQuerySystemTimePrecise documentation: KeQuerySystemTime is described as accurate within a system clock tick, while the precise routine uses the performance counter for interpolation and is described as accurate within a microsecond. However, those statements do not identify which routine supplies the process exit timestamp or when it is sampled. They therefore do not establish a "one tick plus one microsecond" bound for this comparison.

    The submicrosecond precision documented for GetSystemTimePreciseAsFileTime also does not establish the uncertainty of the historical exit value. The timestamp difference includes the actual interval between the represented events as well as any differential timestamp error. System-time adjustments can affect that comparison even within one guest. The System Time documentation notes that system time can be adjusted forward or backward when Windows synchronizes with a time source and advises against comparing system time readings to determine elapsed time.

    I found no guarantee in these sources specific to build 26100 or to the managed termination scenarios described. The missing patch identity and native termination trace limit implementation-specific conclusions, but do not change what the public documentation establishes. The ten observed inequalities remain valid observations without supplying a maximum tolerance.

    A stronger guarantee would require a specification identifying the exit timestamp's sampling point, clock source, rounding behavior, and error bound, together with its applicable builds, termination paths, and clock-adjustment assumptions. Implementation analysis could establish behavior for a particular configuration but would need separate justification before being generalized.

    And if you found my support helpful or informative, I'd really appreciate it if you could follow this guide so others with a similar issue can benefit as well.  

    Thank you.

    Was this answer helpful?

    0 comments No comments

  2. AI answer

    2026-11-16T10:17:33.39+00:00

    No documented maximum relative error bound applies between the GetProcessTimes exit timestamp and a later GetSystemTimePreciseAsFileTime reading, even when a successful wait establishes that process termination occurred before the precise UTC call.

    What is documented

    • GetProcessTimes returns the process exit time as a point in time represented by a FILETIME: a 64-bit count of 100-nanosecond units since January 1, 1601. If the process has not exited, the exit-time output is undefined. The documentation does not specify:
      • the exact termination step at which the value is captured;
      • whether it is sampled before, during, or after any particular cleanup step;
      • its effective resolution or maximum error;
      • its rounding or truncation rule;
      • a relationship to QPC or to a subsequent precise system-time reading.
        ^1^
    • GetSystemTimePreciseAsFileTime returns the current UTC system time with the highest available precision, documented as less than one microsecond. It is intended for high-resolution UTC time-of-day measurements, not for establishing the accuracy of another API’s previously stored timestamp.^2^
    • The corresponding kernel documentation explains the precise-time mechanism: KeQuerySystemTimePrecise combines the most recent system-clock value with elapsed time measured by the performance counter and reports accuracy within a microsecond. That guarantee concerns the precise read itself; it does not propagate backward to the process exit timestamp.^3^

    Thus, subtracting the values produces an observed difference in their common UTC-based representation, but no documented API contract turns that difference into a bounded measurement of the interval from exit-time recording to the precise read.

    Termination ordering versus timestamp semantics

    A process object becomes signaled when the process terminates, and waiting threads are then released. The general termination sequence includes setting the exit code and signaling the process object.^4^

    For the termination path caused by returning from managed Main, the documented native behavior is that returning from main results in ExitProcess. Its sequence places the process status change before the process object becomes signaled.^5^ A successful WaitForSingleObject on that handle therefore establishes synchronization with the signaled process object.^6^

    However, these pages do not place the internal exit-time assignment at a named step in that sequence. Consequently, they establish:

    process terminated and object signaled
        happens before
    successful wait returns
        happens before
    GetSystemTimePreciseAsFileTime call
    

    They do not establish a documented maximum for:

    precise UTC reading - stored process exit time
    

    Nor do they define whether the exit timestamp denotes entry into termination, final-thread termination, exit-status assignment, process-object signaling, or another internal point.

    Clock source, representation, and rounding

    PsGetProcessExitTime says that it returns the current process’s exit time in system-time format and describes system time as typically updated approximately every ten milliseconds.^7^ That wording is:

    • a description of typical update behavior, not a maximum-error guarantee;
    • not a rounding specification;
    • not an explicit statement that user-mode GetProcessTimes obtains its value through that routine;
    • not a cross-API guarantee relative to precise system time.

    The more detailed system-time documentation says ordinary KeQuerySystemTime is based on the latest clock tick, whose period is typically 500 microseconds to 15.625 milliseconds, and is accurate within one tick.^3^ Nothing supplied for GetProcessTimes explicitly promises that particular sampling or accuracy model for its exit field. It therefore cannot safely be imported as the exit timestamp’s contractual bound.

    The 100-nanosecond FILETIME unit is only the encoding granularity. It does not establish 100-nanosecond source resolution, precision, rounding behavior, or accuracy.

    QPC and UTC adjustments

    QPC is an interval clock independent of external time references. GetSystemTimePreciseAsFileTime supplies UTC-synchronized time, while QPC is recommended for measuring short intervals on one system or VM.^8^ Bracketing the calls with QPC can bound when each API call executed in the collector, but it cannot determine when the historical exit value was captured unless Windows documents a mapping from that event to QPC.

    System time may also be adjusted forward or backward during synchronization, and Microsoft explicitly warns against using system-time readings to measure elapsed time.^9^ An unchanged QPC frequency does not rule out such UTC adjustment because QPC frequency is not the UTC discipline state.

    Scope of the conclusion

    For Windows build 26100, the cited public API contracts provide no build-specific extension to this behavior. They also provide no distinct timestamp bounds for normal ExitProcess, TerminateProcess, fatal-exception, last-thread, shutdown, or other termination paths. Different paths have documented termination behavior—for example, external TerminateProcess is asynchronous until a wait confirms termination—but no documented exit-time accuracy contract is attached to them.^10^

    Your ten observations support only the implementation behavior seen in that Sandbox run. They cannot establish a portable maximum, rounding rule, or guarantee for other builds, servicing revisions, hypervisors, clock adjustments, or termination paths. Establishing such a bound would require an additional Microsoft specification explicitly defining the recording instant and error model; those details are not present in the public contracts cited here.


    References

    1. GetProcessTimes function (processthreadsapi.h)
    2. GetSystemTimePreciseAsFileTime function (sysinfoapi.h)
    3. KeQuerySystemTimePrecise function (wdm.h)
    4. Terminating a Process
    5. ExitProcess function (processthreadsapi.h)
    6. WaitForSingleObject function (synchapi.h)
    7. PsGetProcessExitTime function (ntifs.h)
    8. Acquiring high-resolution time stamps
    9. System Time
    10. TerminateProcess function (processthreadsapi.h)
    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.