aboutsummaryrefslogtreecommitdiff
path: root/libbb/time.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-06-27 02:52:20 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-06-27 02:52:20 +0000
commitdefc1ea34074e7882724c460260d307cdf981a70 (patch)
treefca9b9a5fe243f9c0c76b84824ea2ff92ea8e589 /libbb/time.c
parent26bc57d8b26425f23f4be974cce7bf35c95c9a1a (diff)
downloadbusybox-w32-defc1ea34074e7882724c460260d307cdf981a70.tar.gz
busybox-w32-defc1ea34074e7882724c460260d307cdf981a70.tar.bz2
busybox-w32-defc1ea34074e7882724c460260d307cdf981a70.zip
*: introduce and use FAST_FUNC: regparm on i386, otherwise no-on
text data bss dec hex filename 808035 611 6868 815514 c719a busybox_old 804472 611 6868 811951 c63af busybox_unstripped
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}