From 4a2a4bd95b8c0ce284f428be5ddcf937b5ce7662 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 10 Mar 2015 02:41:24 -0500 Subject: [svn-r26413] Merge of r26276 from trunk. Cleans up time functions in the autotools input files. - Lumps all the time functionality together in configure.ac. This was previously more spread out due to Solaris issues with the ordering of certain checks. - Removes processing that handles __tm_gmtoff members of struct tm. (libc-4) - Removes BSDgettimeofday(). (IRIX 5.3) - Removes timezone struct processing in gettimeofday(). (considered harmful) Fixes: HDFFV-9083 and HDFFV-9085 Tested on: h5committest OS X (quail) Solaris (emu) --- config/cmake/H5pubconf.h.in | 23 -- configure | 499 ++++++----------------------------------- configure.ac | 73 +----- release_docs/RELEASE.txt | 28 +++ src/H5Omtime.c | 38 +--- src/H5config.h.in | 30 --- src/H5private.h | 3 - testpar/t_cache.c | 3 +- tools/perform/sio_standalone.h | 1 - 9 files changed, 111 insertions(+), 587 deletions(-) diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 841a811..3628537 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -82,9 +82,6 @@ long long values. */ #cmakedefine H5_FP_TO_ULLONG_RIGHT_MAXIMUM @H5_FP_TO_ULLONG_RIGHT_MAXIMUM@ -/* Define if gettimeofday() populates the tz pointer passed in */ -#cmakedefine H5_GETTIMEOFDAY_GIVES_TZ @H5_GETTIMEOFDAY_GIVES_TZ@ - /* Define to 1 if you have the `alarm' function. */ #cmakedefine H5_HAVE_ALARM @H5_HAVE_ALARM@ @@ -94,9 +91,6 @@ /* Define if the __attribute__(()) extension is present */ #cmakedefine H5_HAVE_ATTRIBUTE @H5_HAVE_ATTRIBUTE@ -/* Define to 1 if you have the `BSDgettimeofday' function. */ -#cmakedefine H5_HAVE_BSDGETTIMEOFDAY @H5_HAVE_BSDGETTIMEOFDAY@ - /* Define if the compiler understands C99 designated initialization of structs and unions */ #cmakedefine H5_HAVE_C99_DESIGNATED_INITIALIZER @H5_HAVE_C99_DESIGNATED_INITIALIZER@ @@ -355,12 +349,6 @@ /* Define if `struct text_info' is defined */ #cmakedefine H5_HAVE_STRUCT_TEXT_INFO @H5_HAVE_STRUCT_TEXT_INFO@ -/* Define if `struct timezone' is defined */ -#cmakedefine H5_HAVE_STRUCT_TIMEZONE @H5_HAVE_STRUCT_TIMEZONE@ - -/* Define to 1 if `tm_zone' is a member of `struct tm'. */ -#cmakedefine H5_HAVE_STRUCT_TM_TM_ZONE @H5_HAVE_STRUCT_TM_TM_ZONE@ - /* Define if `struct videoconfig' is defined */ #cmakedefine H5_HAVE_STRUCT_VIDEOCONFIG @H5_HAVE_STRUCT_VIDEOCONFIG@ @@ -424,14 +412,6 @@ /* Define if `tm_gmtoff' is a member of `struct tm' */ #cmakedefine H5_HAVE_TM_GMTOFF @H5_HAVE_TM_GMTOFF@ -/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use - `HAVE_STRUCT_TM_TM_ZONE' instead. */ -#cmakedefine H5_HAVE_TM_ZONE @H5_HAVE_TM_ZONE@ - -/* Define to 1 if you don't have `tm_zone' but do have the external array - `tzname'. */ -#cmakedefine H5_HAVE_TZNAME @H5_HAVE_TZNAME@ - /* Define to 1 if you have the header file. */ #cmakedefine H5_HAVE_UNISTD_H @H5_HAVE_UNISTD_H@ @@ -462,9 +442,6 @@ /* Define to 1 if you have the `_scrsize' function. */ #cmakedefine H5_HAVE__SCRSIZE @H5_HAVE__SCRSIZE@ -/* Define if `__tm_gmtoff' is a member of `struct tm' */ -#cmakedefine H5_HAVE___TM_GMTOFF @H5_HAVE___TM_GMTOFF@ - /* Define if your system can't handle converting floating-point values to long long. */ #cmakedefine H5_HW_FP_TO_LLONG_NOT_WORKS @H5_HW_FP_TO_LLONG_NOT_WORKS@ diff --git a/configure b/configure index ef35f67..6a68943 100755 --- a/configure +++ b/configure @@ -2671,79 +2671,6 @@ $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_decl - -# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES -# ---------------------------------------------------- -# Tries to find if the field MEMBER exists in type AGGR, after including -# INCLUDES, setting cache variable VAR accordingly. -ac_fn_c_check_member () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 -$as_echo_n "checking for $2.$3... " >&6; } -if eval \${$4+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$5 -#ifdef FC_DUMMY_MAIN -#ifndef FC_DUMMY_MAIN_EQ_F77 -# ifdef __cplusplus - extern "C" -# endif - int FC_DUMMY_MAIN() { return 1; } -#endif -#endif -int -main () -{ -static $2 ac_aggr; -if (ac_aggr.$3) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$4=yes" -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$5 -#ifdef FC_DUMMY_MAIN -#ifndef FC_DUMMY_MAIN_EQ_F77 -# ifdef __cplusplus - extern "C" -# endif - int FC_DUMMY_MAIN() { return 1; } -#endif -#endif -int -main () -{ -static $2 ac_aggr; -if (sizeof ac_aggr.$3) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$4=yes" -else - eval "$4=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$4 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_member cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. @@ -22529,113 +22456,6 @@ $as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h fi -## ---------------------------------------------------------------------- -## Check for these two functions before the time headers are checked -## for, otherwise they are not detected correctly on Solaris (the -## configure test will fail due to multiply-defined symbols). -## -for ac_func in difftime -do : - ac_fn_c_check_func "$LINENO" "difftime" "ac_cv_func_difftime" -if test "x$ac_cv_func_difftime" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_DIFFTIME 1 -_ACEOF - -fi -done - -for ac_func in gettimeofday -do : - ac_fn_c_check_func "$LINENO" "gettimeofday" "ac_cv_func_gettimeofday" -if test "x$ac_cv_func_gettimeofday" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_GETTIMEOFDAY 1 -_ACEOF - have_gettime="yes" -else - have_gettime="no" -fi -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5 -$as_echo_n "checking for library containing clock_gettime... " >&6; } -if ${ac_cv_search_clock_gettime+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char clock_gettime (); -#ifdef FC_DUMMY_MAIN -#ifndef FC_DUMMY_MAIN_EQ_F77 -# ifdef __cplusplus - extern "C" -# endif - int FC_DUMMY_MAIN() { return 1; } -#endif -#endif -int -main () -{ -return clock_gettime (); - ; - return 0; -} -_ACEOF -for ac_lib in '' rt posix4; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_clock_gettime=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if ${ac_cv_search_clock_gettime+:} false; then : - break -fi -done -if ${ac_cv_search_clock_gettime+:} false; then : - -else - ac_cv_search_clock_gettime=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_clock_gettime" >&5 -$as_echo "$ac_cv_search_clock_gettime" >&6; } -ac_res=$ac_cv_search_clock_gettime -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - -fi - -for ac_func in clock_gettime -do : - ac_fn_c_check_func "$LINENO" "clock_gettime" "ac_cv_func_clock_gettime" -if test "x$ac_cv_func_clock_gettime" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_CLOCK_GETTIME 1 -_ACEOF - have_clock_gettime="yes" -else - have_clock_gettime="no" -fi -done - - ## Unix for ac_header in sys/resource.h sys/time.h unistd.h sys/ioctl.h sys/stat.h do : @@ -26326,42 +26146,6 @@ $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -## check if `struct tm' has a `__tm_gmtoff' member. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __tm_gmtoff in struct tm" >&5 -$as_echo_n "checking for __tm_gmtoff in struct tm... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - #include - #include -#ifdef FC_DUMMY_MAIN -#ifndef FC_DUMMY_MAIN_EQ_F77 -# ifdef __cplusplus - extern "C" -# endif - int FC_DUMMY_MAIN() { return 1; } -#endif -#endif -int -main () -{ -struct tm tm; tm.__tm_gmtoff=0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -$as_echo "#define HAVE___TM_GMTOFF 1" >>confdefs.h - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ## Check whether the global variable `timezone' is defined. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for global timezone variable" >&5 $as_echo_n "checking for global timezone variable... " >&6; } @@ -26408,217 +26192,6 @@ rm -f core conftest.err conftest.$ac_objext \ ;; esac -## Check whether `struct timezone' is defined. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5 -$as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; } -if ${ac_cv_struct_tm+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include - -#ifdef FC_DUMMY_MAIN -#ifndef FC_DUMMY_MAIN_EQ_F77 -# ifdef __cplusplus - extern "C" -# endif - int FC_DUMMY_MAIN() { return 1; } -#endif -#endif -int -main () -{ -struct tm tm; - int *p = &tm.tm_sec; - return !p; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_struct_tm=time.h -else - ac_cv_struct_tm=sys/time.h -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_tm" >&5 -$as_echo "$ac_cv_struct_tm" >&6; } -if test $ac_cv_struct_tm = sys/time.h; then - -$as_echo "#define TM_IN_SYS_TIME 1" >>confdefs.h - -fi - -ac_fn_c_check_member "$LINENO" "struct tm" "tm_zone" "ac_cv_member_struct_tm_tm_zone" "#include -#include <$ac_cv_struct_tm> - -" -if test "x$ac_cv_member_struct_tm_tm_zone" = xyes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_TM_TM_ZONE 1 -_ACEOF - - -fi - -if test "$ac_cv_member_struct_tm_tm_zone" = yes; then - -$as_echo "#define HAVE_TM_ZONE 1" >>confdefs.h - -else - ac_fn_c_check_decl "$LINENO" "tzname" "ac_cv_have_decl_tzname" "#include -" -if test "x$ac_cv_have_decl_tzname" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_TZNAME $ac_have_decl -_ACEOF - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tzname" >&5 -$as_echo_n "checking for tzname... " >&6; } -if ${ac_cv_var_tzname+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#if !HAVE_DECL_TZNAME -extern char *tzname[]; -#endif - -#ifdef FC_DUMMY_MAIN -#ifndef FC_DUMMY_MAIN_EQ_F77 -# ifdef __cplusplus - extern "C" -# endif - int FC_DUMMY_MAIN() { return 1; } -#endif -#endif -int -main () -{ -return tzname[0][0]; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_var_tzname=yes -else - ac_cv_var_tzname=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_var_tzname" >&5 -$as_echo "$ac_cv_var_tzname" >&6; } - if test $ac_cv_var_tzname = yes; then - -$as_echo "#define HAVE_TZNAME 1" >>confdefs.h - - fi -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct timezone" >&5 -$as_echo_n "checking for struct timezone... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - #include - #include - #include -#ifdef FC_DUMMY_MAIN -#ifndef FC_DUMMY_MAIN_EQ_F77 -# ifdef __cplusplus - extern "C" -# endif - int FC_DUMMY_MAIN() { return 1; } -#endif -#endif -int -main () -{ -struct timezone tz; tz.tz_minuteswest=0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -$as_echo "#define HAVE_STRUCT_TIMEZONE 1" >>confdefs.h - - have_struct_tz="yes" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -## If gettimeofday() is going to be used, make sure it uses the timezone struct - -if test "$have_gettime" = "yes" -a "$have_struct_tz" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gettimeofday() gives timezone" >&5 -$as_echo_n "checking whether gettimeofday() gives timezone... " >&6; } - if ${hdf5_cv_gettimeofday_tz+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run test program while cross compiling -See \`config.log' for more details" "$LINENO" 5; } -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - #include - #include - int main(void) - { - struct timeval tv; - struct timezone tz; - tz.tz_minuteswest = 7777; /* Initialize to an unreasonable number */ - tz.tz_dsttime = 7; - gettimeofday(&tv, &tz); - /* Check whether the function returned any value at all */ - if(tz.tz_minuteswest == 7777 && tz.tz_dsttime == 7) - exit(1); - else exit (0); - } -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - hdf5_cv_gettimeofday_tz=yes -else - hdf5_cv_gettimeofday_tz=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi - - - if test ${hdf5_cv_gettimeofday_tz} = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -$as_echo "#define GETTIMEOFDAY_GIVES_TZ 1" >>confdefs.h - - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi -fi ## ---------------------------------------------------------------------- ## Does the struct stat have the st_blocks field? This field is not Posix. @@ -26838,7 +26411,73 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ## ---------------------------------------------------------------------- ## Check for functions. ## -for ac_func in alarm BSDgettimeofday fork frexpf frexpl +## NOTE: clock_gettime may require linking to the rt or posix4 library +## so we'll search for it before calling AC_CHECK_FUNCS. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5 +$as_echo_n "checking for library containing clock_gettime... " >&6; } +if ${ac_cv_search_clock_gettime+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char clock_gettime (); +#ifdef FC_DUMMY_MAIN +#ifndef FC_DUMMY_MAIN_EQ_F77 +# ifdef __cplusplus + extern "C" +# endif + int FC_DUMMY_MAIN() { return 1; } +#endif +#endif +int +main () +{ +return clock_gettime (); + ; + return 0; +} +_ACEOF +for ac_lib in '' rt posix4; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_clock_gettime=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_clock_gettime+:} false; then : + break +fi +done +if ${ac_cv_search_clock_gettime+:} false; then : + +else + ac_cv_search_clock_gettime=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_clock_gettime" >&5 +$as_echo "$ac_cv_search_clock_gettime" >&6; } +ac_res=$ac_cv_search_clock_gettime +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + +for ac_func in alarm clock_gettime difftime fork frexpf frexpl do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -26850,7 +26489,7 @@ _ACEOF fi done -for ac_func in gethostname getpwuid getrusage lstat +for ac_func in gethostname getpwuid getrusage gettimeofday do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -26862,7 +26501,7 @@ _ACEOF fi done -for ac_func in rand_r random setsysinfo +for ac_func in lstat rand_r random setsysinfo do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" diff --git a/configure.ac b/configure.ac index 401a2b9..f915a8b 100644 --- a/configure.ac +++ b/configure.ac @@ -997,16 +997,6 @@ dnl AC_CHECK_LIB([coug], [main]) ## ...for ASCI/Red AC_HEADER_STDC AC_HEADER_TIME -## ---------------------------------------------------------------------- -## Check for these two functions before the time headers are checked -## for, otherwise they are not detected correctly on Solaris (the -## configure test will fail due to multiply-defined symbols). -## -AC_CHECK_FUNCS([difftime]) -AC_CHECK_FUNCS([gettimeofday], [have_gettime="yes"], [have_gettime="no"]) -AC_SEARCH_LIBS([clock_gettime], [rt posix4]) -AC_CHECK_FUNCS([clock_gettime],[have_clock_gettime="yes"],[have_clock_gettime="no"]) - ## Unix AC_CHECK_HEADERS([sys/resource.h sys/time.h unistd.h sys/ioctl.h sys/stat.h]) AC_CHECK_HEADERS([sys/socket.h sys/types.h]) @@ -1741,16 +1731,6 @@ AC_TRY_COMPILE([ AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) -## check if `struct tm' has a `__tm_gmtoff' member. -AC_MSG_CHECKING([for __tm_gmtoff in struct tm]) -AC_TRY_COMPILE([ - #include - #include ], [struct tm tm; tm.__tm_gmtoff=0;], - [AC_DEFINE([HAVE___TM_GMTOFF], [1], - [Define if `__tm_gmtoff' is a member of `struct tm']) - AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no])]) - ## Check whether the global variable `timezone' is defined. AC_MSG_CHECKING([for global timezone variable]) @@ -1769,50 +1749,6 @@ case "`uname`" in ;; esac -## Check whether `struct timezone' is defined. -AC_STRUCT_TIMEZONE -AC_MSG_CHECKING([for struct timezone]) -AC_TRY_COMPILE([ - #include - #include - #include ], [struct timezone tz; tz.tz_minuteswest=0;], - [AC_DEFINE([HAVE_STRUCT_TIMEZONE], [1], - [Define if `struct timezone' is defined]) - have_struct_tz="yes" - AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no])]) - -## If gettimeofday() is going to be used, make sure it uses the timezone struct - -if test "$have_gettime" = "yes" -a "$have_struct_tz" = "yes"; then - AC_MSG_CHECKING(whether gettimeofday() gives timezone) - AC_CACHE_VAL([hdf5_cv_gettimeofday_tz], - [AC_TRY_RUN([ - #include - #include - int main(void) - { - struct timeval tv; - struct timezone tz; - tz.tz_minuteswest = 7777; /* Initialize to an unreasonable number */ - tz.tz_dsttime = 7; - gettimeofday(&tv, &tz); - /* Check whether the function returned any value at all */ - if(tz.tz_minuteswest == 7777 && tz.tz_dsttime == 7) - exit(1); - else exit (0); - }], - [hdf5_cv_gettimeofday_tz=yes], - [hdf5_cv_gettimeofday_tz=no])]) - - if test ${hdf5_cv_gettimeofday_tz} = "yes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE([GETTIMEOFDAY_GIVES_TZ], [1], - [Define if gettimeofday() populates the tz pointer passed in]) - else - AC_MSG_RESULT([no]) - fi -fi ## ---------------------------------------------------------------------- ## Does the struct stat have the st_blocks field? This field is not Posix. @@ -1870,9 +1806,12 @@ AC_TRY_COMPILE([#include ],[int w=TIOCGETD;], ## ---------------------------------------------------------------------- ## Check for functions. ## -AC_CHECK_FUNCS([alarm BSDgettimeofday fork frexpf frexpl]) -AC_CHECK_FUNCS([gethostname getpwuid getrusage lstat]) -AC_CHECK_FUNCS([rand_r random setsysinfo]) +## NOTE: clock_gettime may require linking to the rt or posix4 library +## so we'll search for it before calling AC_CHECK_FUNCS. +AC_SEARCH_LIBS([clock_gettime], [rt posix4]) +AC_CHECK_FUNCS([alarm clock_gettime difftime fork frexpf frexpl]) +AC_CHECK_FUNCS([gethostname getpwuid getrusage gettimeofday]) +AC_CHECK_FUNCS([lstat rand_r random setsysinfo]) AC_CHECK_FUNCS([signal longjmp setjmp siglongjmp sigsetjmp sigprocmask]) AC_CHECK_FUNCS([snprintf srandom strdup symlink system]) AC_CHECK_FUNCS([tmpfile asprintf vasprintf waitpid]) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 134a5c5..31e1dd9 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -155,6 +155,34 @@ New Features (DER - 2015-03-08, HDFFV-9086) + - Removed obsolete time functionality from configure and C library + + The library contained some residual functionality from obsolete + time zone handling code. This has been removed and the configure + checks for the time functions have been cleaned up. + + * Lumped all the time functionality together in configure.ac. + This was previously more spread out due to Solaris issues + with the ordering of certain checks. + + * Removes processing that handles __tm_gmtoff members of struct + tm. (libc-4) + + * Removes BSDgettimeofday(). (IRIX 5.3) + + * Removes timezone struct handling in gettimeofday(). (considered + harmful) + + Note that the HDF5 library stores timestamps in a platform-independent + manner, so old files can still be read. This only affects convering + system time to HDF5 timestamps. + + The library currently uses the tm_gmtoff member of the tm struct + (preferred, if available) or the timezone global variable to + construct HDF5 timestamps. + + (DER - 2015-03-09, HDFFV-9083 and 9085) + Library ------- - None diff --git a/src/H5Omtime.c b/src/H5Omtime.c index e719e08..a3703b5 100644 --- a/src/H5Omtime.c +++ b/src/H5Omtime.c @@ -194,8 +194,8 @@ H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, /* decode */ for(i = 0; i < 14; i++) - if(!HDisdigit(p[i])) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "badly formatted modification time message") + if(!HDisdigit(p[i])) + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "badly formatted modification time message") /* * Convert YYYYMMDDhhmmss UTC to a time_t. This is a little problematic @@ -213,36 +213,14 @@ H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, tm.tm_sec = (p[12]-'0')*10 + (p[13]-'0'); tm.tm_isdst = -1; /*figure it out*/ if((time_t)-1 == (the_time = HDmktime(&tm))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "badly formatted modification time message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "badly formatted modification time message") #if defined(H5_HAVE_TM_GMTOFF) - /* FreeBSD, OSF 4.0 */ + /* BSD-like systems */ the_time += tm.tm_gmtoff; -#elif defined(H5_HAVE___TM_GMTOFF) - /* Linux libc-4 */ - the_time += tm.__tm_gmtoff; #elif defined(H5_HAVE_TIMEZONE) - /* Linux libc-5 */ - the_time -= timezone - (tm.tm_isdst?3600:0); -#elif defined(H5_HAVE_BSDGETTIMEOFDAY) && defined(H5_HAVE_STRUCT_TIMEZONE) - /* Irix5.3 */ - { - struct timezone tz; - - if(HDBSDgettimeofday(NULL, &tz) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to obtain local timezone information") - the_time -= tz.tz_minuteswest * 60 - (tm.tm_isdst ? 3600 : 0); - } -#elif defined(H5_HAVE_GETTIMEOFDAY) && defined(H5_HAVE_STRUCT_TIMEZONE) && defined(H5_GETTIMEOFDAY_GIVES_TZ) - { - struct timezone tz; - struct timeval tv; /* Used as a placebo; some systems don't like NULL */ - - if(HDgettimeofday(&tv, &tz) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to obtain local timezone information") - - the_time -= tz.tz_minuteswest * 60 - (tm.tm_isdst ? 3600 : 0); - } + /* GNU/Linux systems */ + the_time -= timezone - (tm.tm_isdst ? 3600 : 0); #else /* * The catch-all. If we can't convert a character string universal @@ -251,14 +229,12 @@ H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, * only way a user can get the modification time is from our internal * query routines, which can gracefully recover. */ - - /* Irix64 */ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to obtain local timezone information") #endif /* The return value */ if(NULL == (mesg = H5FL_MALLOC(time_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") *mesg = the_time; /* Set return value */ diff --git a/src/H5config.h.in b/src/H5config.h.in index 0eba3bb..a2fa0ad 100644 --- a/src/H5config.h.in +++ b/src/H5config.h.in @@ -49,9 +49,6 @@ long long values. */ #undef FP_TO_ULLONG_RIGHT_MAXIMUM -/* Define if gettimeofday() populates the tz pointer passed in */ -#undef GETTIMEOFDAY_GIVES_TZ - /* Define to 1 if you have the `alarm' function. */ #undef HAVE_ALARM @@ -61,9 +58,6 @@ /* Define if the __attribute__(()) extension is present */ #undef HAVE_ATTRIBUTE -/* Define to 1 if you have the `BSDgettimeofday' function. */ -#undef HAVE_BSDGETTIMEOFDAY - /* Define if the compiler understands C99 designated initialization of structs and unions */ #undef HAVE_C99_DESIGNATED_INITIALIZER @@ -80,10 +74,6 @@ /* Define if Darwin or Mac OS X */ #undef HAVE_DARWIN -/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't. - */ -#undef HAVE_DECL_TZNAME - /* Define to 1 if you have the `difftime' function. */ #undef HAVE_DIFFTIME @@ -298,12 +288,6 @@ /* Define if `struct text_info' is defined */ #undef HAVE_STRUCT_TEXT_INFO -/* Define if `struct timezone' is defined */ -#undef HAVE_STRUCT_TIMEZONE - -/* Define to 1 if `tm_zone' is a member of `struct tm'. */ -#undef HAVE_STRUCT_TM_TM_ZONE - /* Define if `struct videoconfig' is defined */ #undef HAVE_STRUCT_VIDEOCONFIG @@ -364,14 +348,6 @@ /* Define if `tm_gmtoff' is a member of `struct tm' */ #undef HAVE_TM_GMTOFF -/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use - `HAVE_STRUCT_TM_TM_ZONE' instead. */ -#undef HAVE_TM_ZONE - -/* Define to 1 if you don't have `tm_zone' but do have the external array - `tzname'. */ -#undef HAVE_TZNAME - /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H @@ -399,9 +375,6 @@ /* Define to 1 if you have the `_scrsize' function. */ #undef HAVE__SCRSIZE -/* Define if `__tm_gmtoff' is a member of `struct tm' */ -#undef HAVE___TM_GMTOFF - /* Define if your system can't handle converting floating-point values to long long. */ #undef HW_FP_TO_LLONG_NOT_WORKS @@ -609,9 +582,6 @@ /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME -/* Define to 1 if your declares `struct tm'. */ -#undef TM_IN_SYS_TIME - /* Define if your system can compile unsigned long long to floating-point casts. */ #undef ULLONG_TO_FP_CAST_WORKS diff --git a/src/H5private.h b/src/H5private.h index 2a3c79e..c4e3d02 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -608,9 +608,6 @@ typedef struct { #ifndef HDatol #define HDatol(S) atol(S) #endif /* HDatol */ -#ifndef HDBSDgettimeofday - #define HDBSDgettimeofday(S,P) BSDgettimeofday(S,P) -#endif /* HDBSDgettimeofday */ #ifndef HDbsearch #define HDbsearch(K,B,N,Z,F) bsearch(K,B,N,Z,F) #endif /* HDbsearch */ diff --git a/testpar/t_cache.c b/testpar/t_cache.c index 85315ce..290cd3f 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -4242,7 +4242,6 @@ setup_rand(void) unsigned predefined_seeds[3] = {33402, 33505, 33422}; unsigned seed; struct timeval tv; - struct timezone tz; if ( ( use_predefined_seeds ) && ( world_mpi_size == num_predefined_seeds ) ) { @@ -4258,7 +4257,7 @@ setup_rand(void) } else { - if ( HDgettimeofday(&tv, &tz) != 0 ) { + if ( HDgettimeofday(&tv, NULL) != 0 ) { nerrors++; if ( verbose ) { diff --git a/tools/perform/sio_standalone.h b/tools/perform/sio_standalone.h index b2f8220..4eb1ded 100644 --- a/tools/perform/sio_standalone.h +++ b/tools/perform/sio_standalone.h @@ -87,7 +87,6 @@ #define HDatof(S) atof(S) #define HDatoi(S) atoi(S) #define HDatol(S) atol(S) -#define HDBSDgettimeofday(S,P) BSDgettimeofday(S,P) #define HDbsearch(K,B,N,Z,F) bsearch(K,B,N,Z,F) #define HDcalloc(N,Z) calloc(N,Z) #define HDceil(X) ceil(X) -- cgit v0.12