[Mono-devel-list] [PATCH] Bug Fix for GetTickCount in WAPI IO Layer

Ben Maurer bmaurer at ximian.com
Sat Feb 26 19:48:07 EST 2005


On Sat, 2005-02-26 at 13:07 -0800, Jesse Towner wrote:
> This should fix the problem of System.Environment.TickCount reporting
> incorrect values on
> non-windows systems. It now determines the boot time of the system, and
> from there can
> determine the uptime, which is what GetTickCount requires. I haven't
> tested it on all of the
> platforms it should support, so any feedback would be appreciated.

Since GetTickCount is modulo 48 days anyways (env.TickCount has half the
resolution since it is always positive), the thing should *NEVER* be
used for uptime calculation. The only correct use for tick count is to
calculate the change in time, for changes known to be relatively small.

This doesn't make the method much slower, so its not that bad. But it
sure is alot of complexity for something that should never be used.

-- Ben




More information about the Mono-devel-list mailing list