diff options
Diffstat (limited to 'misc.c')
-rw-r--r-- | misc.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -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 | ||
912 | double | ||
913 | monotime_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 | |||
912 | void | 923 | void |
913 | bandwidth_limit_init(struct bwlimit *bw, u_int64_t kbps, size_t buflen) | 924 | bandwidth_limit_init(struct bwlimit *bw, u_int64_t kbps, size_t buflen) |
914 | { | 925 | { |