strftime() was in C89 so use it unconditionally.
This commit is contained in:
@@ -654,9 +654,6 @@
|
|||||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||||
#undef HAVE_STDLIB_H
|
#undef HAVE_STDLIB_H
|
||||||
|
|
||||||
/* Define to 1 if you have the `strftime' function. */
|
|
||||||
#undef HAVE_STRFTIME
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <strings.h> header file. */
|
/* Define to 1 if you have the <strings.h> header file. */
|
||||||
#undef HAVE_STRINGS_H
|
#undef HAVE_STRINGS_H
|
||||||
|
|
||||||
|
3
configure
vendored
3
configure
vendored
@@ -2847,7 +2847,6 @@ as_fn_append ac_header_list " sys/sysmacros.h"
|
|||||||
as_fn_append ac_func_list " fexecve"
|
as_fn_append ac_func_list " fexecve"
|
||||||
as_fn_append ac_func_list " killpg"
|
as_fn_append ac_func_list " killpg"
|
||||||
as_fn_append ac_func_list " nl_langinfo"
|
as_fn_append ac_func_list " nl_langinfo"
|
||||||
as_fn_append ac_func_list " strftime"
|
|
||||||
as_fn_append ac_func_list " pread"
|
as_fn_append ac_func_list " pread"
|
||||||
as_fn_append ac_func_list " pwrite"
|
as_fn_append ac_func_list " pwrite"
|
||||||
as_fn_append ac_func_list " openat"
|
as_fn_append ac_func_list " openat"
|
||||||
@@ -18692,8 +18691,6 @@ done
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
case "$host_os" in
|
case "$host_os" in
|
||||||
hpux*)
|
hpux*)
|
||||||
if test X"$ac_cv_func_pread" = X"yes"; then
|
if test X"$ac_cv_func_pread" = X"yes"; then
|
||||||
|
@@ -2394,7 +2394,7 @@ dnl
|
|||||||
dnl Function checks
|
dnl Function checks
|
||||||
dnl
|
dnl
|
||||||
AC_FUNC_GETGROUPS
|
AC_FUNC_GETGROUPS
|
||||||
AC_CHECK_FUNCS_ONCE([fexecve killpg nl_langinfo strftime pread pwrite openat faccessat wordexp])
|
AC_CHECK_FUNCS_ONCE([fexecve killpg nl_langinfo pread pwrite openat faccessat wordexp])
|
||||||
case "$host_os" in
|
case "$host_os" in
|
||||||
hpux*)
|
hpux*)
|
||||||
if test X"$ac_cv_func_pread" = X"yes"; then
|
if test X"$ac_cv_func_pread" = X"yes"; then
|
||||||
|
@@ -28,13 +28,10 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Return a static buffer with the current date + time.
|
* Return a static buffer with the current date + time.
|
||||||
* Uses strftime() if available, else falls back to ctime().
|
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
get_timestr(time_t tstamp, int log_year)
|
get_timestr(time_t tstamp, int log_year)
|
||||||
{
|
{
|
||||||
char *s;
|
|
||||||
#ifdef HAVE_STRFTIME
|
|
||||||
static char buf[128];
|
static char buf[128];
|
||||||
struct tm *timeptr;
|
struct tm *timeptr;
|
||||||
|
|
||||||
@@ -45,17 +42,5 @@ get_timestr(time_t tstamp, int log_year)
|
|||||||
timeptr) != 0 && buf[sizeof(buf) - 1] == '\0')
|
timeptr) != 0 && buf[sizeof(buf) - 1] == '\0')
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
return NULL;
|
||||||
#endif /* HAVE_STRFTIME */
|
|
||||||
|
|
||||||
s = ctime(&tstamp);
|
|
||||||
if (s != NULL) {
|
|
||||||
s += 4; /* skip day of the week */
|
|
||||||
if (log_year)
|
|
||||||
s[20] = '\0'; /* avoid the newline */
|
|
||||||
else
|
|
||||||
s[15] = '\0'; /* don't care about year */
|
|
||||||
}
|
|
||||||
|
|
||||||
return s;
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user