[commit] r4802 - in freeswitch/trunk: . src src/include
Author: mikej Date: Thu Mar 29 21:40:50 2007 New Revision: 4802 Modified: freeswitch/trunk/configure.in freeswitch/trunk/src/include/switch_am_config.h.in freeswitch/trunk/src/include/switch_platform.h freeswitch/trunk/src/include/switch_scheduler.h freeswitch/trunk/src/switch_scheduler.c Log: use int64_t internally for storage of time_t values in the scheduler because at least then we know what format string to use to print them, and they are often that type anyways. Modified: freeswitch/trunk/configure.in ============================================================================== --- freeswitch/trunk/configure.in (original) +++ freeswitch/trunk/configure.in Thu Mar 29 21:40:50 2007 @@ -171,7 +171,6 @@ 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) @@ -247,16 +246,6 @@ size_t_fmt='#error Can not determine the proper size for size_t' fi -if 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_int"; then - time_t_fmt='#define TIME_T_FMT "d"' -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, @@ -305,7 +294,6 @@ 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) Modified: freeswitch/trunk/src/include/switch_am_config.h.in ============================================================================== --- freeswitch/trunk/src/include/switch_am_config.h.in (original) +++ freeswitch/trunk/src/include/switch_am_config.h.in Thu Mar 29 21:40:50 2007 @@ -15,6 +15,5 @@ @size_t_fmt@ @int64_t_fmt@ @uint64_t_fmt@ -@time_t_fmt@ #endif Modified: freeswitch/trunk/src/include/switch_platform.h ============================================================================== --- freeswitch/trunk/src/include/switch_platform.h (original) +++ freeswitch/trunk/src/include/switch_platform.h Thu Mar 29 21:40:50 2007 @@ -201,12 +201,6 @@ #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") Modified: freeswitch/trunk/src/include/switch_scheduler.h ============================================================================== --- freeswitch/trunk/src/include/switch_scheduler.h (original) +++ freeswitch/trunk/src/include/switch_scheduler.h Thu Mar 29 21:40:50 2007 @@ -40,8 +40,8 @@ ///\ingroup core1 ///\{ struct switch_scheduler_task { - time_t created; - time_t runtime; + int64_t created; + int64_t runtime; uint32_t cmd_id; char *group; void *cmd_arg; Modified: freeswitch/trunk/src/switch_scheduler.c ============================================================================== --- freeswitch/trunk/src/switch_scheduler.c (original) +++ freeswitch/trunk/src/switch_scheduler.c Thu Mar 29 21:40:50 2007 @@ -2,7 +2,7 @@ struct switch_scheduler_task_container { switch_scheduler_task_t task; - time_t executed; + int64_t executed; int in_thread; int destroyed; switch_scheduler_func_t func; @@ -35,7 +35,7 @@ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-ID", "%u", tp->task.task_id); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-Desc", "%s", tp->desc); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-Group", "%s", switch_str_nil(tp->task.group)); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-Runtime", "%" TIME_T_FMT, tp->task.runtime); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-Runtime", "%" SWITCH_INT64_T_FMT, tp->task.runtime); switch_event_fire(&event); } } else { @@ -43,7 +43,7 @@ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-ID", "%u", tp->task.task_id); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-Desc", "%s", tp->desc); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-Group", "%s", switch_str_nil(tp->task.group)); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-Runtime", "%" TIME_T_FMT, tp->task.runtime); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-Runtime", "%" SWITCH_INT64_T_FMT, tp->task.runtime); switch_event_fire(&event); } tp->destroyed = 1; @@ -75,7 +75,7 @@ if (done) { tp->destroyed = 1; } else { - time_t now = time(NULL); + int64_t now = time(NULL); if (now >= tp->task.runtime && !tp->in_thread) { tp->executed = now; if (switch_test_flag(tp, SSHF_OWN_THREAD)) { @@ -174,14 +174,14 @@ switch_mutex_unlock(globals.task_mutex); tp = container; - 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); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Added task %u %s (%s) to run at %" SWITCH_INT64_T_FMT "\n", + tp->task.task_id, tp->desc, switch_str_nil(tp->task.group), tp->task.runtime); if (switch_event_create(&event, SWITCH_EVENT_ADD_SCHEDULE) == SWITCH_STATUS_SUCCESS) { switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-ID", "%u", tp->task.task_id); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-Desc", "%s", tp->desc); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-Group", "%s", switch_str_nil(tp->task.group)); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-Runtime", "%" TIME_T_FMT, tp->task.runtime); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-Runtime", "%" SWITCH_INT64_T_FMT, tp->task.runtime); switch_event_fire(&event); } return container->task.task_id; @@ -201,7 +201,7 @@ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-ID", "%u", tp->task.task_id); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-Desc", "%s", tp->desc); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-Group", "%s", switch_str_nil(tp->task.group)); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-Runtime", "%" TIME_T_FMT, tp->task.runtime); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-Runtime", "%" SWITCH_INT64_T_FMT, tp->task.runtime); switch_event_fire(&event); } status = SWITCH_STATUS_SUCCESS; @@ -226,7 +226,7 @@ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-ID", "%u", tp->task.task_id); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-Desc", "%s", tp->desc); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-Group", "%s", switch_str_nil(tp->task.group)); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-Runtime", "%" TIME_T_FMT, tp->task.runtime); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Task-Runtime", "%" SWITCH_INT64_T_FMT, tp->task.runtime); switch_event_fire(&event); } tp->destroyed++;
participants (1)
-
Freeswitch SVN