Changeset: 91a33e3cf794 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=91a33e3cf794
Modified Files:
clients/src/mapiclient/mclient.mx
Branch: default
Log Message:
fix new timer functionality also for queries that run longer than 35 minutes
Casting microseconds from 63 bit (64 bit signed) to 31 bit (32 bit signed)
will overflow for values that represent times larger than 35.79 minutes.
Hence, as with the old time code, we only cast to long (which is 32 bit on
many 32 bit systems) only once we have casted microseconds to milliseconds
(devision by 1000) --- then, the overflow only occurs for values that
represent times larger than 24.85 days --- we hope that not single query
will run that long ...
The cast to long is merely used for convenience to use formatting strings
like "%7ld.%03ldms" without having to care about portability.
diffs (27 lines):
diff -r 71f8bec5bcae -r 91a33e3cf794 clients/src/mapiclient/mclient.mx
--- a/clients/src/mapiclient/mclient.mx Fri Jul 16 13:14:41 2010 +0200
+++ b/clients/src/mapiclient/mclient.mx Fri Jul 16 13:28:44 2010 +0200
@@ -346,19 +346,19 @@
static char *
timerHuman()
{
- long t = (long)(t1 - t0);
+ timertype t = t1 - t0;
if (t / 1000 < 950) {
- snprintf(htimbuf, 32, "%ld.%03ldms", t / 1000, t % 1000);
+ snprintf(htimbuf, 32, "%ld.%03ldms", (long) (t / 1000), (long)
(t % 1000));
return(htimbuf);
}
t /= 1000;
if (t / 1000 < 60) {
- snprintf(htimbuf, 32, "%ld.%02lds", t / 1000, t % 1000);
+ snprintf(htimbuf, 32, "%ld.%02lds", (long) (t / 1000), (long)
(t % 1000));
return(htimbuf);
}
t /= 1000;
- snprintf(htimbuf, 32, "%ldm %lds", t / 60, t % 60);
+ snprintf(htimbuf, 32, "%ldm %lds", (long) (t / 60), (long) (t % 60));
return(htimbuf);
}
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list