summaryrefslogtreecommitdiffstats
path: root/misc.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2013-06-01 23:46:16 +0200
committerDarren Tucker <dtucker@zip.com.au>2013-06-01 23:46:16 +0200
commitb759c9c2efebe7b416ab81093ca8eb17836b6933 (patch)
tree41ad0279844ea8f149ab2c1015fa140061b390ac /misc.c
parent - dtucker@cvs.openbsd.org 2013/05/31 12:28:10 (diff)
downloadopenssh-b759c9c2efebe7b416ab81093ca8eb17836b6933.tar.xz
openssh-b759c9c2efebe7b416ab81093ca8eb17836b6933.zip
- dtucker@cvs.openbsd.org 2013/06/01 13:15:52
[ssh-agent.c clientloop.c misc.h packet.c progressmeter.c misc.c channels.c sandbox-systrace.c] Use clock_gettime(CLOCK_MONOTONIC ...) for ssh timers so that things like keepalives and rekeying will work properly over clock steps. Suggested by markus@, "looks good" djm@.
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/misc.c b/misc.c
index 4aa5fdc8b..cd45e9ecc 100644
--- a/misc.c
+++ b/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.89 2013/05/17 00:13:13 djm Exp $ */
+/* $OpenBSD: misc.c,v 1.90 2013/06/01 13:15:52 dtucker Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
* Copyright (c) 2005,2006 Damien Miller. All rights reserved.
@@ -854,6 +854,17 @@ ms_to_timeval(struct timeval *tv, int ms)
tv->tv_usec = (ms % 1000) * 1000;
}
+time_t
+monotime(void)
+{
+ struct timespec ts;
+
+ if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0)
+ fatal("clock_gettime: %s", strerror(errno));
+
+ return (ts.tv_sec);
+}
+
void
bandwidth_limit_init(struct bwlimit *bw, u_int64_t kbps, size_t buflen)
{