summaryrefslogtreecommitdiff
path: root/clientloop.c
diff options
context:
space:
mode:
authordtucker@openbsd.org@openbsd.org <dtucker@openbsd.org@openbsd.org>2017-11-25 05:58:47 +0000
committerDamien Miller <djm@mindrot.org>2017-11-28 11:39:13 +1100
commit2d638e986085bdf1a40310ed6e2307463db96ea0 (patch)
tree25ec768247c7ffa818dece200a25c8730c86c05f /clientloop.c
parentba460acae48a36ef749cb23068f968f4d5d90a24 (diff)
upstream commit
Remove get_current_time() and replace with calls to monotime_double() which uses CLOCK_MONOTONIC and works over clock steps. "I like" markus@ OpenBSD-Commit-ID: 3ad2f7d2414e2cfcaef99877a7a5b0baf2242952
Diffstat (limited to 'clientloop.c')
-rw-r--r--clientloop.c19
1 files changed, 3 insertions, 16 deletions
diff --git a/clientloop.c b/clientloop.c
index 46ede4f0e..e3824ccd9 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: clientloop.c,v 1.306 2017/10/23 05:08:00 djm Exp $ */ 1/* $OpenBSD: clientloop.c,v 1.307 2017/11/25 05:58:47 dtucker Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -226,19 +226,6 @@ signal_handler(int sig)
226} 226}
227 227
228/* 228/*
229 * Returns current time in seconds from Jan 1, 1970 with the maximum
230 * available resolution.
231 */
232
233static double
234get_current_time(void)
235{
236 struct timeval tv;
237 gettimeofday(&tv, NULL);
238 return (double) tv.tv_sec + (double) tv.tv_usec / 1000000.0;
239}
240
241/*
242 * Sets control_persist_exit_time to the absolute time when the 229 * Sets control_persist_exit_time to the absolute time when the
243 * backgrounded control master should exit due to expiry of the 230 * backgrounded control master should exit due to expiry of the
244 * ControlPersist timeout. Sets it to 0 if we are not a backgrounded 231 * ControlPersist timeout. Sets it to 0 if we are not a backgrounded
@@ -1256,7 +1243,7 @@ client_loop(struct ssh *ssh, int have_pty, int escape_char_arg,
1256 fatal("%s pledge(): %s", __func__, strerror(errno)); 1243 fatal("%s pledge(): %s", __func__, strerror(errno));
1257 } 1244 }
1258 1245
1259 start_time = get_current_time(); 1246 start_time = monotime_double();
1260 1247
1261 /* Initialize variables. */ 1248 /* Initialize variables. */
1262 last_was_cr = 1; 1249 last_was_cr = 1;
@@ -1445,7 +1432,7 @@ client_loop(struct ssh *ssh, int have_pty, int escape_char_arg,
1445 buffer_free(&stderr_buffer); 1432 buffer_free(&stderr_buffer);
1446 1433
1447 /* Report bytes transferred, and transfer rates. */ 1434 /* Report bytes transferred, and transfer rates. */
1448 total_time = get_current_time() - start_time; 1435 total_time = monotime_double() - start_time;
1449 packet_get_bytes(&ibytes, &obytes); 1436 packet_get_bytes(&ibytes, &obytes);
1450 verbose("Transferred: sent %llu, received %llu bytes, in %.1f seconds", 1437 verbose("Transferred: sent %llu, received %llu bytes, in %.1f seconds",
1451 (unsigned long long)obytes, (unsigned long long)ibytes, total_time); 1438 (unsigned long long)obytes, (unsigned long long)ibytes, total_time);