diff options
author | Darren Tucker <dtucker@zip.com.au> | 2013-06-01 23:46:16 +0200 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2013-06-01 23:46:16 +0200 |
commit | b759c9c2efebe7b416ab81093ca8eb17836b6933 (patch) | |
tree | 41ad0279844ea8f149ab2c1015fa140061b390ac /misc.c | |
parent | - dtucker@cvs.openbsd.org 2013/05/31 12:28:10 (diff) | |
download | openssh-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.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -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) { |