summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
authordtucker@openbsd.org <dtucker@openbsd.org>2016-03-02 22:42:40 +0000
committerDamien Miller <djm@mindrot.org>2016-03-04 15:12:19 +1100
commitb8d4eafe29684fe4f5bb587f7eab948e6ed62723 (patch)
tree3bdc08a366a144ea37ee94907d62f21fa52d2f53 /misc.c
parent18f64b969c70ed00e74b9d8e50359dbe698ce4c0 (diff)
upstream commit
Improve precision of progressmeter for sftp and scp by storing sub-second timestamps. Pointed out by mmcc@, ok deraadt@ markus@ Upstream-ID: 38fd83a3d83dbf81c8ff7b5d1302382fe54970ab
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 de7e1facd..3136f3492 100644
--- a/misc.c
+++ b/misc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: misc.c,v 1.101 2016/01/20 09:22:39 dtucker Exp $ */ 1/* $OpenBSD: misc.c,v 1.102 2016/03/02 22:42:40 dtucker Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000 Markus Friedl. All rights reserved.
4 * Copyright (c) 2005,2006 Damien Miller. All rights reserved. 4 * Copyright (c) 2005,2006 Damien Miller. All rights reserved.
@@ -909,6 +909,17 @@ monotime(void)
909 return time(NULL); 909 return time(NULL);
910} 910}
911 911
912double
913monotime_double(void)
914{
915 struct timespec ts;
916
917 if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0)
918 fatal("clock_gettime: %s", strerror(errno));
919
920 return (ts.tv_sec + (double)ts.tv_nsec / 1000000000);
921}
922
912void 923void
913bandwidth_limit_init(struct bwlimit *bw, u_int64_t kbps, size_t buflen) 924bandwidth_limit_init(struct bwlimit *bw, u_int64_t kbps, size_t buflen)
914{ 925{