summaryrefslogtreecommitdiff
path: root/coreutils/date.c
diff options
context:
space:
mode:
authorDenys Vlasenko2010-06-18 02:55:48 +0200
committerDenys Vlasenko2010-06-18 02:55:48 +0200
commit4ebdae3777b8c9175d5d07090989f7e498befc42 (patch)
tree8afe9cfbf7798389f094ef459592599e475cd8bf /coreutils/date.c
parent5b1dfe609c472b9b311ff3b135f4a5563d12848e (diff)
downloadbusybox-4ebdae3777b8c9175d5d07090989f7e498befc42.zip
busybox-4ebdae3777b8c9175d5d07090989f7e498befc42.tar.gz
date: make %N work without -lrt on glibc
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils/date.c')
-rw-r--r--coreutils/date.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/coreutils/date.c b/coreutils/date.c
index 8f9aff8..c737f09 100644
--- a/coreutils/date.c
+++ b/coreutils/date.c
@@ -93,6 +93,9 @@
//config: MMDDhhmm[[YY]YY][.ss] format.
#include "libbb.h"
+#if ENABLE_FEATURE_DATE_NANO
+# include <sys/syscall.h>
+#endif
enum {
OPT_RFC2822 = (1 << 0), /* R */
@@ -208,7 +211,9 @@ int date_main(int argc UNUSED_PARAM, char **argv)
#endif
} else {
#if ENABLE_FEATURE_DATE_NANO
- clock_gettime(CLOCK_REALTIME, &ts);
+ /* libc has incredibly messy way of doing this,
+ * typically requiring -lrt. We just skip all this mess */
+ syscall(__NR_clock_gettime, CLOCK_REALTIME, &ts);
#else
time(&ts.tv_sec);
#endif