summaryrefslogtreecommitdiff
path: root/src/lib/libast/features/tvlib
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2012-06-24 22:28:35 +0000
committerIgor Pashev <pashev.igor@gmail.com>2012-06-24 22:28:35 +0000
commit3950ffe2a485479f6561c27364d3d7df5a21d124 (patch)
tree468c6e14449d1b1e279222ec32f676b0311917d2 /src/lib/libast/features/tvlib
downloadksh-3950ffe2a485479f6561c27364d3d7df5a21d124.tar.gz
Imported Upstream version 93u+upstream
Diffstat (limited to 'src/lib/libast/features/tvlib')
-rw-r--r--src/lib/libast/features/tvlib80
1 files changed, 80 insertions, 0 deletions
diff --git a/src/lib/libast/features/tvlib b/src/lib/libast/features/tvlib
new file mode 100644
index 0000000..9b2f64f
--- /dev/null
+++ b/src/lib/libast/features/tvlib
@@ -0,0 +1,80 @@
+hdr time
+lib clock_settime,gettimeofday,settimeofday,stime,utimes
+lib nanosleep,usleep
+lib utimensat -D_ATFILE_SOURCE sys/stat.h note{ complete utimensat implementation }end link{
+ #include <fcntl.h>
+ static struct timespec ts[2];
+ int
+ main()
+ {
+ ts[0].tv_nsec = UTIME_NOW;
+ ts[1].tv_nsec = UTIME_OMIT;
+ return utimensat(AT_FDCWD, ".", ts, AT_SYMLINK_NOFOLLOW) != 0;
+ }
+}end
+
+if ! mem timeval.tv_sec sys/time.h {
+ struct timeval
+ {
+ time_t tv_sec;
+ time_t tv_usec;
+ };
+}
+endif
+
+lib clock_gettime execute{
+ #include <time.h>
+ int
+ main()
+ {
+ struct timespec tv;
+ return clock_gettime(CLOCK_REALTIME, &tv) != 0;
+ }
+}end
+
+lib utimets link{
+ #include <time.h>
+ #include <sys/time.h>
+ static struct timespec tv;
+ int
+ main()
+ {
+ return utimets(".", &tv) != 0;
+ }
+}end
+
+tst - -DN=1 - -DN=2 - -DN=3 - -DN=4 output{
+ #include <sys/types.h>
+ #include <sys/time.h>
+ int
+ main()
+ {
+ struct timeval tv;
+#if N == 1
+ struct timezone tz;
+ if (gettimeofday(&tv, (struct timezone*)0) < 0)
+ return 1;
+ printf("#define tmgettimeofday(p) gettimeofday(p,(struct timezone*)0)\n");
+#if _lib_settimeofday
+ printf("#define tmsettimeofday(p) settimeofday(p,(struct timezone*)0)\n");
+#endif
+#endif
+#if N == 2
+ if (gettimeofday(&tv, (void*)0) < 0)
+ return 1;
+ printf("#define tmgettimeofday(p) gettimeofday(p,(void*)0)\n");
+#if _lib_settimeofday
+ printf("#define tmsettimeofday(p) gettimeofday(p,(void*)0)\n");
+#endif
+#endif
+#if N == 3
+ if (gettimeofday(&tv) < 0)
+ return 1;
+ printf("#define tmgettimeofday(p) gettimeofday(p)\n");
+#if _lib_settimeofday
+ printf("#define tmsettimeofday(p) settimeofday(p)\n");
+#endif
+#endif
+ return 0;
+ }
+}end