db_info *dbs;
tbl_info *tbl;
PGresult *res = NULL;
- long long diff = 0;
+ double diff;
struct timeval now,
then;
/* Figure out how long to sleep etc ... */
gettimeofday(&now, 0);
- diff = (now.tv_sec - then.tv_sec) * 1000000 + (now.tv_usec - then.tv_usec);
+ diff = (int) (now.tv_sec - then.tv_sec) * 1000000.0 + (int) (now.tv_usec - then.tv_usec);
- sleep_secs = args->sleep_base_value + args->sleep_scaling_factor * diff / 1000000;
+ sleep_secs = args->sleep_base_value + args->sleep_scaling_factor * diff / 1000000.0;
loops++;
if (args->debug >= 2)
{
sprintf(logbuffer,
- "%i All DBs checked in: %lld usec, will sleep for %i secs.",
+ "%i All DBs checked in: %.0f usec, will sleep for %i secs.",
loops, diff, sleep_secs);
log_entry(logbuffer);
}
/*
- * $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
*/
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);