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

Dick Porter dick at ximian.com
Mon Feb 28 08:02:39 EST 2005

On Sat, 2005-02-26 at 19:48 -0500, Ben Maurer wrote:
> 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.

For some reason I didn't get the original message (and it wasn't in my
spam folder either) so I can't comment on the patch itself.

However, using GetTickCount to look up the boot time is completely
pointless on reliable OSes, because as Ben says the 32bit counter wraps
round every 47 days.  Therefore I won't be applying a patch to "fix"
this non-issue.

- Dick

More information about the Mono-devel-list mailing list