diff options
author | Darren Tucker <dtucker@cvs.openbsd.org> | 2017-11-25 05:58:48 +0000 |
---|---|---|
committer | Darren Tucker <dtucker@cvs.openbsd.org> | 2017-11-25 05:58:48 +0000 |
commit | 11811783a1ed46f25063c9e930d70b1a181af280 (patch) | |
tree | d8c9c7b66d34c8ddc0d3df799452cfb657b5ef6e /usr.bin | |
parent | 1ddf67d41dbb162089dcfc2aa94a8fcc87d6d6a8 (diff) |
Remove get_current_time() and replace with calls to monotime_double()
which uses CLOCK_MONOTONIC and works over clock steps. "I like" markus@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/ssh/clientloop.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/usr.bin/ssh/clientloop.c b/usr.bin/ssh/clientloop.c index 21c976b4257..be133219e24 100644 --- a/usr.bin/ssh/clientloop.c +++ b/usr.bin/ssh/clientloop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clientloop.c,v 1.306 2017/10/23 05:08:00 djm Exp $ */ +/* $OpenBSD: clientloop.c,v 1.307 2017/11/25 05:58:47 dtucker Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -218,19 +218,6 @@ signal_handler(int sig) } /* - * Returns current time in seconds from Jan 1, 1970 with the maximum - * available resolution. - */ - -static double -get_current_time(void) -{ - struct timeval tv; - gettimeofday(&tv, NULL); - return (double) tv.tv_sec + (double) tv.tv_usec / 1000000.0; -} - -/* * Sets control_persist_exit_time to the absolute time when the * backgrounded control master should exit due to expiry of the * ControlPersist timeout. Sets it to 0 if we are not a backgrounded @@ -1247,7 +1234,7 @@ client_loop(struct ssh *ssh, int have_pty, int escape_char_arg, fatal("%s pledge(): %s", __func__, strerror(errno)); } - start_time = get_current_time(); + start_time = monotime_double(); /* Initialize variables. */ last_was_cr = 1; @@ -1436,7 +1423,7 @@ client_loop(struct ssh *ssh, int have_pty, int escape_char_arg, buffer_free(&stderr_buffer); /* Report bytes transferred, and transfer rates. */ - total_time = get_current_time() - start_time; + total_time = monotime_double() - start_time; packet_get_bytes(&ibytes, &obytes); verbose("Transferred: sent %llu, received %llu bytes, in %.1f seconds", (unsigned long long)obytes, (unsigned long long)ibytes, total_time); |