This patch revises the logic in SystemTimeConverter to detect backwards and
forwards skew between the two time sources: the native time source (represented
by the Time type) and the time source used to generate TimeStamp objects.
Previously the CurrentX11TimeGetter and CurrentWindowsTimeGetter classes acted
as functors with a single operator() method. In preparation for handling clock
skew, this patch refactors these two helper classes into regular classes with
two named methods:
GetCurrentTime which matches the existing operator() method, and
GetTimeAsyncForPossibleBackwardsSkew which will be used when possible
backwards skew is detected to fetch the current time asynchronously.
Some renaming is also included to match the expanded role of these classes.
This patch exploits the fact that the underlying Time type is an unsigned
integer to simplify some of the overflow checks in SystemTimeConvert by relying
on unsigned integer overflow behavior, which, unlike signed integer overflow, is
well-defined.
Various operations in the time conversion assume that the native event time is
an unsigned integer so this patch adds and assertion to check this precondition
is met.
This just moves the code from widget/windows/nsWindow.cpp to a template class in
widget/xpwidgets/WrappingTimeConverter.h so that we can reuse this code for
other platforms (GTK at least).