]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
use autoconf determined time_t printf format specifier
authorMichael Jerris <mike@jerris.com>
Thu, 29 Mar 2007 04:08:18 +0000 (04:08 +0000)
committerMichael Jerris <mike@jerris.com>
Thu, 29 Mar 2007 04:08:18 +0000 (04:08 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4787 d0543943-73ff-0310-b7d9-9358b9ac24b2

configure.in
src/include/switch_am_config.h.in
src/include/switch_platform.h
src/switch_core.c

index 468d8d33b2fee860c22c037f53f21a8159c5bfe8..1240e717166ba8b9db1ef9158d359c28becdae80 100644 (file)
@@ -171,6 +171,7 @@ AC_CHECK_SIZEOF(int, 4)
 AC_CHECK_SIZEOF(long, 4)
 AC_CHECK_SIZEOF(short, 2)
 AC_CHECK_SIZEOF(long long, 8)
+AC_CHECK_SIZEOF(time_t, 4)
 AC_TYPE_SIZE_T
 AC_CHECK_TYPE(ssize_t, int)
 
@@ -246,6 +247,16 @@ else
     size_t_fmt='#error Can not determine the proper size for size_t'
 fi
 
+if test "$ac_cv_sizeof_time_t" = "$ac_cv_sizeof_int"; then
+   time_t_fmt='#define TIME_T_FMT "d"' 
+elif  test "$ac_cv_sizeof_time_t" = "$ac_cv_sizeof_long"; then
+   time_t_fmt='#define TIME_T_FMT "ld"'
+elif  test "$ac_cv_sizeof_time_t" = "$ac_cv_sizeof_long_long"; then
+   time_t_fmt='#define TIME_T_FMT "lld"'
+else
+    time_t_fmt='#error Can not determine the proper format specifier for time_t of size $ac_cv_sizeof_time_t'
+fi
+
 # Basically, we have tried to figure out the correct format strings
 # for SWITCH types which vary between platforms, but we don't always get 
 # it right.  If you find that we don't get it right for your platform, 
@@ -294,8 +305,7 @@ AC_SUBST(int64_t_fmt)
 AC_SUBST(uint64_t_fmt) 
 AC_SUBST(ssize_t_fmt) 
 AC_SUBST(size_t_fmt)
-
-
+AC_SUBST(time_t_fmt)
 
 AC_PATH_PROGS(ZCAT, gunzip gzcat gzip zcat)
 AC_PATH_PROGS(TAR, gtar tar)
index a4be7f9f05607d604cb4f3e1b814a82dc94ccca3..34ff6fef0cefea1ddc851ed7dd0c34b5013fc742 100644 (file)
@@ -15,5 +15,6 @@
 @size_t_fmt@
 @int64_t_fmt@
 @uint64_t_fmt@
+@time_t_fmt@
 
 #endif
index 65675f3a5845810cebd1d2089935a0ecc33aa491..2fbd5da16fe6bc2560272f8aaeb26c0b279b3a63 100644 (file)
@@ -213,6 +213,12 @@ typedef  intptr_t  switch_ssize_t;
 #define SWITCH_INT64_T_FMT          "I64d"
 #define SWITCH_UINT64_T_FMT         "I64u"
 
+#ifdef _USE_32BIT_TIME_T
+#define TIME_T_FMT "d"
+#else
+#define TIME_T_FMT SWITCH_INT64_T_FMT
+#endif
+
 #else
 #ifndef SWITCH_SSIZE_T_FMT
 #define SWITCH_SSIZE_T_FMT          (sizeof (switch_ssize_t) == sizeof (long) ? "ld" : sizeof (switch_ssize_t) == sizeof (int) ? "d" : "lld")
@@ -230,6 +236,10 @@ typedef  intptr_t  switch_ssize_t;
 #define SWITCH_UINT64_T_FMT         (sizeof (long) == 8 ? "lu" : "llu")
 #endif
 
+#ifndef TIME_T_FMT
+#define TIME_T_FMT "ld"
+#endif
+
 #endif
 
 #define SWITCH_TIME_T_FMT SWITCH_INT64_T_FMT
index 6b7ecd578af045cb9f307bc8ef4ab4f94d7af5e1..b7c6d83ef2ca84767bd4ea859d08e8118526d994 100644 (file)
@@ -402,7 +402,7 @@ SWITCH_DECLARE(uint32_t) switch_core_scheduler_add_task(time_t task_runtime,
        switch_mutex_unlock(runtime.task_mutex);
        
        tp = container;
-       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Added task %u %s (%s) to run at %ld\n", 
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Added task %u %s (%s) to run at %"TIME_T_FMT"\n", 
                                          tp->task.task_id, tp->desc, switch_str_nil(tp->task.group), task_runtime);