diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-06-18 02:55:48 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-06-18 02:55:48 +0200 |
commit | 4ebdae3777b8c9175d5d07090989f7e498befc42 (patch) | |
tree | 8afe9cfbf7798389f094ef459592599e475cd8bf | |
parent | 5b1dfe609c472b9b311ff3b135f4a5563d12848e (diff) | |
download | busybox-w32-4ebdae3777b8c9175d5d07090989f7e498befc42.tar.gz busybox-w32-4ebdae3777b8c9175d5d07090989f7e498befc42.tar.bz2 busybox-w32-4ebdae3777b8c9175d5d07090989f7e498befc42.zip |
date: make %N work without -lrt on glibc
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | coreutils/date.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/coreutils/date.c b/coreutils/date.c index 8f9aff8b0..c737f09f3 100644 --- a/coreutils/date.c +++ b/coreutils/date.c | |||
@@ -93,6 +93,9 @@ | |||
93 | //config: MMDDhhmm[[YY]YY][.ss] format. | 93 | //config: MMDDhhmm[[YY]YY][.ss] format. |
94 | 94 | ||
95 | #include "libbb.h" | 95 | #include "libbb.h" |
96 | #if ENABLE_FEATURE_DATE_NANO | ||
97 | # include <sys/syscall.h> | ||
98 | #endif | ||
96 | 99 | ||
97 | enum { | 100 | enum { |
98 | OPT_RFC2822 = (1 << 0), /* R */ | 101 | OPT_RFC2822 = (1 << 0), /* R */ |
@@ -208,7 +211,9 @@ int date_main(int argc UNUSED_PARAM, char **argv) | |||
208 | #endif | 211 | #endif |
209 | } else { | 212 | } else { |
210 | #if ENABLE_FEATURE_DATE_NANO | 213 | #if ENABLE_FEATURE_DATE_NANO |
211 | clock_gettime(CLOCK_REALTIME, &ts); | 214 | /* libc has incredibly messy way of doing this, |
215 | * typically requiring -lrt. We just skip all this mess */ | ||
216 | syscall(__NR_clock_gettime, CLOCK_REALTIME, &ts); | ||
212 | #else | 217 | #else |
213 | time(&ts.tv_sec); | 218 | time(&ts.tv_sec); |
214 | #endif | 219 | #endif |