summaryrefslogtreecommitdiff
path: root/contrib/pgbench
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2003-12-07 19:55:58 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2003-12-07 19:55:58 +0000
commit9c26980f58c63188bba8cb38eb7a5170bec2a3e9 (patch)
tree453ae00dae8c9e0cfd7df69f1ae41af2b40ec6c4 /contrib/pgbench
parent80af69ceaaf0b6712251207fea863fbb33fba4c0 (diff)
downloadpostgresql-9c26980f58c63188bba8cb38eb7a5170bec2a3e9.tar.gz
Replace unportable and overflow-prone use of 'long long' with safer
'double' arithmetic, per recent discussion.
Diffstat (limited to 'contrib/pgbench')
-rw-r--r--contrib/pgbench/pgbench.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/contrib/pgbench/pgbench.c b/contrib/pgbench/pgbench.c
index b42a692691..ae06dde2ee 100644
--- a/contrib/pgbench/pgbench.c
+++ b/contrib/pgbench/pgbench.c
@@ -1,5 +1,5 @@
/*
- * $PostgreSQL: pgsql/contrib/pgbench/pgbench.c,v 1.29 2003/11/29 19:51:35 pgsql Exp $
+ * $PostgreSQL: pgsql/contrib/pgbench/pgbench.c,v 1.30 2003/12/07 19:55:58 tgl Exp $
*
* pgbench: a simple TPC-B like benchmark program for PostgreSQL
* written by Tatsuo Ishii
@@ -261,14 +261,14 @@ doOne(CState * state, int n, int debug, int ttype)
*/
if (use_log)
{
- long long diff;
+ double diff;
struct timeval now;
gettimeofday(&now, 0);
- diff = (now.tv_sec - st->txn_begin.tv_sec) * 1000000 +
- (now.tv_usec - st->txn_begin.tv_usec);
+ diff = (int) (now.tv_sec - st->txn_begin.tv_sec) * 1000000.0 +
+ (int) (now.tv_usec - st->txn_begin.tv_usec);
- fprintf(LOGFILE, "%d %d %lld\n", st->id, st->cnt, diff);
+ fprintf(LOGFILE, "%d %d %.0f\n", st->id, st->cnt, diff);
}
res = PQgetResult(st->con);