From: Stanislav K. <sta...@or...> - 2013-11-29 07:01:01
|
On 11/28/2013 03:36 PM, ch...@su... wrote: > Hi! >> Actually, I need. >> >> I use clock_gettime() to get the current time and use it when UTIME_NOW >> is passed. Like this: >> #if HAVE_UTIMENSAT >> ret = utimensat(AT_FDCWD, pathname, times, 0); >> #else >> if (times == NULL) { >> ret = utimes(pathname, NULL); >> } else { >> /* stat and etc */ >> >> ret = clock_gettime(CLOCK_REALTIME, &tp); >> if (ret == -1) >> tst_brkm(TBROK | TERRNO, cleanup_fn, >> "Failed to clock_realtime() at %s:%d", >> file, lineno); >> >> /* handle UTIME_NOW and etc */ >> } >> #endif >> >> >> The compilation of safe_file_ops.c performs ok. libltp.a is formed. But >> compilations of other pieces of code using safe_touch fails with: >> make[1]: Entering directory `/home/stas/ltp/lib/tests' >> gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall -W >> -D_FORTIFY_SOURCE=2 -I../../include -I../../include -L../../lib >> tst_process_state.c -lltp -o tst_process_state >> ../../lib/libltp.a(safe_file_ops.o): In function `safe_touch': >> /home/stas/ltp/lib/safe_file_ops.c:213: undefined reference to >> `clock_gettime' >> collect2: ld returned 1 exit status >> >> I know, that clock_gettime() requires '-lrt'. >> >> But I'm not sure about the right place inside LTP sources to put it in.... > What about using gettimeofday() instead? > Thank you, I will try. |