aboutsummaryrefslogtreecommitdiff
path: root/libbb/time.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/time.c')
-rw-r--r--libbb/time.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libbb/time.c b/libbb/time.c
index 07c009417..7d3ac9183 100644
--- a/libbb/time.c
+++ b/libbb/time.c
@@ -20,14 +20,14 @@
20 20
21/* libc has incredibly messy way of doing this, 21/* libc has incredibly messy way of doing this,
22 * typically requiring -lrt. We just skip all this mess */ 22 * typically requiring -lrt. We just skip all this mess */
23unsigned long long monotonic_us(void) 23unsigned long long FAST_FUNC monotonic_us(void)
24{ 24{
25 struct timespec ts; 25 struct timespec ts;
26 if (syscall(__NR_clock_gettime, CLOCK_MONOTONIC, &ts)) 26 if (syscall(__NR_clock_gettime, CLOCK_MONOTONIC, &ts))
27 bb_error_msg_and_die("clock_gettime(MONOTONIC) failed"); 27 bb_error_msg_and_die("clock_gettime(MONOTONIC) failed");
28 return ts.tv_sec * 1000000ULL + ts.tv_nsec/1000; 28 return ts.tv_sec * 1000000ULL + ts.tv_nsec/1000;
29} 29}
30unsigned monotonic_sec(void) 30unsigned FAST_FUNC monotonic_sec(void)
31{ 31{
32 struct timespec ts; 32 struct timespec ts;
33 if (syscall(__NR_clock_gettime, CLOCK_MONOTONIC, &ts)) 33 if (syscall(__NR_clock_gettime, CLOCK_MONOTONIC, &ts))
@@ -35,14 +35,14 @@ unsigned monotonic_sec(void)
35 return ts.tv_sec; 35 return ts.tv_sec;
36} 36}
37#else 37#else
38unsigned long long monotonic_us(void) 38unsigned long long FAST_FUNC monotonic_us(void)
39{ 39{
40 struct timeval tv; 40 struct timeval tv;
41 gettimeofday(&tv, NULL); 41 gettimeofday(&tv, NULL);
42 return tv.tv_sec * 1000000ULL + tv.tv_usec; 42 return tv.tv_sec * 1000000ULL + tv.tv_usec;
43} 43}
44 44
45unsigned monotonic_sec(void) 45unsigned FAST_FUNC monotonic_sec(void)
46{ 46{
47 return time(NULL); 47 return time(NULL);
48} 48}