summaryrefslogtreecommitdiff
path: root/contrib/pg_autovacuum
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/pg_autovacuum
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/pg_autovacuum')
-rw-r--r--contrib/pg_autovacuum/pg_autovacuum.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/contrib/pg_autovacuum/pg_autovacuum.c b/contrib/pg_autovacuum/pg_autovacuum.c
index 00ccdc68bb..c567c4e7f3 100644
--- a/contrib/pg_autovacuum/pg_autovacuum.c
+++ b/contrib/pg_autovacuum/pg_autovacuum.c
@@ -978,7 +978,7 @@ main(int argc, char *argv[])
db_info *dbs;
tbl_info *tbl;
PGresult *res = NULL;
- long long diff = 0;
+ double diff;
struct timeval now,
then;
@@ -1151,14 +1151,14 @@ main(int argc, char *argv[])
/* 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);
}