← Commit list

4ebdae377

Denys Vlasenko
Denys Vlasenko
2010-06-18
FAILED Duration: 32s

Subject

date: make %N work without -lrt on glibc

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

coreutils/date.c+6 -1
@@ -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