Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
1555aefd
Commit
1555aefd
authored
Mar 05, 2016
by
Matthieu Schaller
Browse files
Check that the required system functions are present at configure time
parent
b3e9532a
Changes
2
Hide whitespace changes
Inline
Side-by-side
configure.ac
View file @
1555aefd
...
...
@@ -329,7 +329,7 @@ is defined in <sys/time.h>])],,
[#if HAVE_SYS_TIME_H
#include <sys/time.h>
#endif])
AC_CHECK_FUNCS([gethrtime read_real_time time_base_to_time clock_gettime mach_absolute_time])
AC_CHECK_FUNCS([gethrtime read_real_time time_base_to_time clock_gettime mach_absolute_time
strftime gettimeofday localtime
])
AC_MSG_CHECKING([for _rtc intrinsic])
rtc_ok=yes
AC_LINK_IFELSE([AC_LANG_PROGRAM(
...
...
src/clocks.c
View file @
1555aefd
...
...
@@ -222,8 +222,17 @@ double clocks_from_ticks(ticks tics) {
*/
const
char
*
clocks_getunit
()
{
return
clocks_units
[
clocks_units_index
];
}
/**
* @brief returns a string containing the local date and time
*
* The date is return in the format [YYYY-MM-DD hh:mm:ss]
*
* @result the current time.
*/
const
char
*
clocks_get_timeofday
()
{
#if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_LOCALTIME) && \
defined(HAVE_STRFTIME)
struct
timeval
time
;
struct
tm
*
local_time
;
static
char
buffer
[
40
];
...
...
@@ -235,5 +244,8 @@ const char *clocks_get_timeofday() {
/* Make it a string */
strftime
(
buffer
,
40
,
"[%F %T]"
,
local_time
);
#else
static
char
buffer
[
40
]
=
"[Unknown time]"
;
#endif
return
buffer
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment