Changeset: 3d85f7a22bfe for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3d85f7a22bfe
Modified Files:
        sql/backends/monet5/prog.c
Branch: Feb2013
Log Message:

use type mapi_int64 instead of type long for time (in microseconds),
such that also on Windows and 32-bit Unix-like systems
times > 35min 47.483647sec can be represented & handled.

Ceterum censeo type long MUST NOT be used as it is everything but portable;
for instance, on our beloved Windows platforms, long is always 32-bit,
even on 64-bit systems.


diffs (45 lines):

diff --git a/sql/backends/monet5/prog.c b/sql/backends/monet5/prog.c
--- a/sql/backends/monet5/prog.c
+++ b/sql/backends/monet5/prog.c
@@ -52,20 +52,20 @@
 # endif
 #endif
 
-static long
+static mapi_int64
 gettime(void)
 {
 #ifdef HAVE_GETTIMEOFDAY
        struct timeval tp;
 
        gettimeofday(&tp, NULL);
-       return (long) tp.tv_sec * 1000000 + (long) tp.tv_usec;
+       return (mapi_int64) tp.tv_sec * 1000000 + (mapi_int64) tp.tv_usec;
 #else
 #ifdef HAVE_FTIME
        struct timeb tb;
 
        ftime(&tb);
-       return (long) tb.time * 1000000 + (long) tb.millitm * 1000;
+       return (mapi_int64) tb.time * 1000000 + (mapi_int64) tb.millitm * 1000;
 #endif
 #endif
 }
@@ -92,7 +92,7 @@ main(int argc, char **av)
        char *prog = *av;
        opt *set = NULL;
        int setlen = 0, timeflag = 0;
-       long t0 = 0;
+       mapi_int64 t0 = 0;
        Mapi mid;
        MapiHdl hdl;
        char *buf, *line;
@@ -208,7 +208,7 @@ main(int argc, char **av)
                } while (mapi_next_result(hdl) == 1);
                mapi_close_handle(hdl);
                if (timeflag)
-                       printf("Timer: %ld (usec)\n", gettime() - t0);
+                       printf("Timer: "LLFMT" (usec)\n", gettime() - t0);
        }
        free(buf);
        mapi_destroy(mid);
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to