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.89 2013/05/17 00:13:13 djm Exp $ */ | 1 | /* $OpenBSD: misc.c,v 1.90 2013/06/01 13:15:52 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. |
@@ -854,6 +854,17 @@ ms_to_timeval(struct timeval *tv, int ms) | |||
854 | tv->tv_usec = (ms % 1000) * 1000; | 854 | tv->tv_usec = (ms % 1000) * 1000; |
855 | } | 855 | } |
856 | 856 | ||
857 | time_t | ||
858 | monotime(void) | ||
859 | { | ||
860 | struct timespec ts; | ||
861 | |||
862 | if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) | ||
863 | fatal("clock_gettime: %s", strerror(errno)); | ||
864 | |||
865 | return (ts.tv_sec); | ||
866 | } | ||
867 | |||
857 | void | 868 | void |
858 | bandwidth_limit_init(struct bwlimit *bw, u_int64_t kbps, size_t buflen) | 869 | bandwidth_limit_init(struct bwlimit *bw, u_int64_t kbps, size_t buflen) |
859 | { | 870 | { |