Hello!
Enrironment.TickCount is supposed to return the miliseconds since the
boot. For my surprise it was returning a negative number which should
only happen on the 47th day of uptime.
I did i fix (attached) but it doesn't seem 100% correct and i am not
sure if it would work after some days.
Since i'm coding a msn library and msn p2p protocol uses GetTickCount(),
it's messing things for me!
Can anyone take a look?
Thanks!
Index: mono/io-layer/timefuncs.c
===================================================================
--- mono/io-layer/timefuncs.c (revision 82331)
+++ mono/io-layer/timefuncs.c (working copy)
@@ -10,6 +10,7 @@
#include <config.h>
#include <glib.h>
#include <sys/time.h>
+#include <sys/times.h>
#include <stdlib.h>
#include <mono/io-layer/wapi.h>
@@ -48,20 +49,11 @@
guint32 GetTickCount (void)
{
- struct timeval tv;
+ struct tms tm;
guint32 ret;
-
- ret=gettimeofday (&tv, NULL);
- if(ret==-1) {
- return(0);
- }
-
- /* This is supposed to return milliseconds since reboot but I
- * really can't be bothered to work out the uptime, especially
- * as the 32bit value wraps around every 47 days
- */
- ret=(guint32)((tv.tv_sec * 1000) + (tv.tv_usec / 1000));
+ ret = times(&tm);
+
#ifdef DEBUG
g_message ("%s: returning %d", __func__, ret);
#endif
_______________________________________________
Mono-list maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list