2012-05-23 Janne Blomqvist <jb@gcc.gnu.org>
PR fortran/53456
* intrinsics/time_1.h (gf_gettime): Fallback for clock_gettime.
From-SVN: r187806
+2012-05-23 Janne Blomqvist <jb@gcc.gnu.org>
+
+ PR fortran/53456
+ * intrinsics/time_1.h (gf_gettime): Fallback for clock_gettime.
+
2012-05-23 Robert Mason <rbmj@verizon.net>
Tobias Burnus <burnus@net-b.de>
#endif
-/* Realtime clock with microsecond resolution, falling back to less
- precise functions if the target does not support gettimeofday().
+/* Realtime clock with microsecond resolution, falling back to other
+ functions if the target does not support gettimeofday().
Arguments:
secs - OUTPUT, seconds
*secs = tv.tv_sec;
*usecs = tv.tv_usec;
return err;
+#elif defined(HAVE_CLOCK_GETTIME)
+ struct timespec ts;
+ int err = clock_gettime (CLOCK_REALTIME, &ts);
+ *secs = ts.tv_sec;
+ *usecs = ts.tv_nsec / 1000;
+ return err;
#else
time_t t = time (NULL);
*secs = t;