diff --git a/contrib/pgbench/pgbench.c b/contrib/pgbench/pgbench.c
index 136a2bf..dc4f819 100644
--- a/contrib/pgbench/pgbench.c
+++ b/contrib/pgbench/pgbench.c
@@ -913,6 +913,7 @@ doCustom(TState *thread, CState *st, instr_time *conn_time, FILE *logfile, AggVa
 {
 	PGresult   *res;
 	Command   **commands;
+	bool        do_throttle = false;
 
 top:
 	commands = sql_files[st->use_file];
@@ -1090,7 +1091,7 @@ top:
 					 * This is more than we really ought to know about
 					 * instr_time
 					 */
-					fprintf(logfile, "%d %d %.0f %d %ld %ld\n",
+					fprintf(logfile, "%d %d %.0f %d %ld.%06ld\n",
 							st->id, st->cnt, usec, st->use_file,
 							(long) now.tv_sec, (long) now.tv_usec);
 #else
@@ -1099,7 +1100,7 @@ top:
 					 * On Windows, instr_time doesn't provide a timestamp
 					 * anyway
 					 */
-					fprintf(logfile, "%d %d %.0f %d 0 0\n",
+					fprintf(logfile, "%d %d %.0f %d 0.0\n",
 							st->id, st->cnt, usec, st->use_file);
 #endif
 				}
@@ -1149,6 +1150,8 @@ top:
 			st->use_file = (int) getrand(thread, 0, num_files - 1);
 			commands = sql_files[st->use_file];
 			st->throttled = false;
+			st->listen = 0;
+			do_throttle = (throttle_delay>0);
 		}
 	}
 
@@ -1167,6 +1170,12 @@ top:
 		INSTR_TIME_ACCUM_DIFF(*conn_time, end, start);
 	}
 
+	if (do_throttle) {
+		/* delay throttling after reopenning the connection */
+		do_throttle = false;
+		goto top;
+	}
+
 	/* Record transaction start time if logging is enabled */
 	if (logfile && st->state == 0)
 		INSTR_TIME_SET_CURRENT(st->txn_begin);
