[commit] r11486 - in freeswitch/trunk: scripts/contrib/dschreiber/mod_nibblebill src src/include src/mod/applications/mod_commands src/mod/applications/mod_dptools src/mod/applications/mod_enum src/mod/applications/mod_esf src/mod/applications/mod_fifo src/mod/applications/mod_fsv src/mod/applications/mod_limit src/mod/applications/mod_rss src/mod/applications/mod_voicemail src/mod/endpoints/mod_alsa src/mod/endpoints/mod_dingaling src/mod/endpoints/mod_portaudio src/mod/endpoints/mod_sof
Author: anthm Date: Sun Jan 25 15:23:07 2009 New Revision: 11486 Log: change low res sleep func api names Modified: freeswitch/trunk/scripts/contrib/dschreiber/mod_nibblebill/mod_nibblebill.c freeswitch/trunk/src/include/switch_core.h freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c freeswitch/trunk/src/mod/applications/mod_esf/mod_esf.c freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c freeswitch/trunk/src/mod/applications/mod_fsv/mod_fsv.c freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c freeswitch/trunk/src/mod/applications/mod_rss/mod_rss.c freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c freeswitch/trunk/src/mod/endpoints/mod_alsa/mod_alsa.c freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c freeswitch/trunk/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c freeswitch/trunk/src/mod/loggers/mod_logfile/mod_logfile.c freeswitch/trunk/src/mod/say/mod_say_de/mod_say_de.c freeswitch/trunk/src/mod/say/mod_say_en/mod_say_en.c freeswitch/trunk/src/mod/say/mod_say_es/mod_say_es.c freeswitch/trunk/src/mod/say/mod_say_fr/mod_say_fr.c freeswitch/trunk/src/mod/say/mod_say_it/mod_say_it.c freeswitch/trunk/src/mod/say/mod_say_nl/mod_say_nl.c freeswitch/trunk/src/mod/say/mod_say_zh/mod_say_zh.c freeswitch/trunk/src/switch_channel.c freeswitch/trunk/src/switch_console.c freeswitch/trunk/src/switch_core.c freeswitch/trunk/src/switch_core_io.c freeswitch/trunk/src/switch_core_port_allocator.c freeswitch/trunk/src/switch_core_session.c freeswitch/trunk/src/switch_core_sqldb.c freeswitch/trunk/src/switch_event.c freeswitch/trunk/src/switch_ivr.c freeswitch/trunk/src/switch_ivr_async.c freeswitch/trunk/src/switch_ivr_originate.c freeswitch/trunk/src/switch_ivr_play_say.c freeswitch/trunk/src/switch_log.c freeswitch/trunk/src/switch_resample.c freeswitch/trunk/src/switch_rtp.c freeswitch/trunk/src/switch_scheduler.c freeswitch/trunk/src/switch_stun.c freeswitch/trunk/src/switch_time.c freeswitch/trunk/src/switch_utils.c Modified: freeswitch/trunk/scripts/contrib/dschreiber/mod_nibblebill/mod_nibblebill.c ============================================================================== --- freeswitch/trunk/scripts/contrib/dschreiber/mod_nibblebill/mod_nibblebill.c (original) +++ freeswitch/trunk/scripts/contrib/dschreiber/mod_nibblebill/mod_nibblebill.c Sun Jan 25 15:23:07 2009 @@ -307,7 +307,7 @@ /* Local vars */ nibble_data_t *nibble_data; - switch_time_t ts = switch_timestamp_now(); + switch_time_t ts = switch_micro_time_now(); float billamount; char date[80] = ""; char *tmp; @@ -476,7 +476,7 @@ static void nibblebill_pause(switch_core_session_t *session) { switch_channel_t *channel = switch_core_session_get_channel(session); - switch_time_t ts = switch_timestamp_now(); + switch_time_t ts = switch_micro_time_now(); nibble_data_t *nibble_data; if (!channel) { @@ -512,7 +512,7 @@ static void nibblebill_resume(switch_core_session_t *session) { switch_channel_t *channel = switch_core_session_get_channel(session); - switch_time_t ts = switch_timestamp_now(); + switch_time_t ts = switch_micro_time_now(); nibble_data_t *nibble_data; if (!channel) { @@ -555,7 +555,7 @@ static void nibblebill_reset(switch_core_session_t *session) { switch_channel_t *channel = switch_core_session_get_channel(session); - switch_time_t ts = switch_timestamp_now(); + switch_time_t ts = switch_micro_time_now(); nibble_data_t *nibble_data; if (!channel) { Modified: freeswitch/trunk/src/include/switch_core.h ============================================================================== --- freeswitch/trunk/src/include/switch_core.h (original) +++ freeswitch/trunk/src/include/switch_core.h Sun Jan 25 15:23:07 2009 @@ -1690,14 +1690,14 @@ SWITCH_DECLARE(switch_loadable_module_interface_t *) switch_loadable_module_create_module_interface(switch_memory_pool_t *pool, const char *name); SWITCH_DECLARE(void *) switch_loadable_module_create_interface(switch_loadable_module_interface_t *mod, switch_module_interface_name_t iname); -SWITCH_DECLARE(switch_time_t) switch_timestamp_now(void); +SWITCH_DECLARE(switch_time_t) switch_micro_time_now(void); SWITCH_DECLARE(void) switch_core_memory_reclaim(void); SWITCH_DECLARE(void) switch_core_memory_reclaim_events(void); SWITCH_DECLARE(void) switch_core_memory_reclaim_logger(void); SWITCH_DECLARE(void) switch_core_memory_reclaim_all(void); SWITCH_DECLARE(void) switch_core_setrlimits(void); SWITCH_DECLARE(void) switch_time_sync(void); -SWITCH_DECLARE(time_t) switch_timestamp(time_t *t); +SWITCH_DECLARE(time_t) switch_epoch_time_now(time_t *t); SWITCH_DECLARE(switch_status_t) switch_strftime_tz(const char *tz, const char *format, char *date, size_t len, switch_time_t thetime); SWITCH_DECLARE(switch_status_t) switch_time_exp_tz_name(const char *tz, switch_time_exp_t *tm, switch_time_t thetime); SWITCH_DECLARE(void) switch_load_network_lists(switch_bool_t reload); Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c ============================================================================== --- freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c (original) +++ freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c Sun Jan 25 15:23:07 2009 @@ -1384,13 +1384,13 @@ uint32_t mto; if (*argv[4] == '+') { if ((mto = atoi(argv[4] + 1)) > 0) { - to = switch_timestamp(NULL) + mto; + to = switch_epoch_time_now(NULL) + mto; } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "INVALID Timeout!\n"); goto done; } } else { - if ((to = atoi(argv[4])) < switch_timestamp(NULL)) { + if ((to = atoi(argv[4])) < switch_epoch_time_now(NULL)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "INVALID Timeout!\n"); to = 0; goto done; @@ -1520,7 +1520,7 @@ time_t when; if (*argv[0] == '+') { - when = switch_timestamp(NULL) + atol(argv[0] + 1); + when = switch_epoch_time_now(NULL) + atol(argv[0] + 1); } else { when = atol(argv[0]); } @@ -1558,7 +1558,7 @@ switch_call_cause_t cause = SWITCH_CAUSE_ALLOTTED_TIMEOUT; if (*argv[0] == '+') { - when = switch_timestamp(NULL) + atol(argv[0] + 1); + when = switch_epoch_time_now(NULL) + atol(argv[0] + 1); } else { when = atol(argv[0]); } @@ -1665,7 +1665,7 @@ time_t when; if (*argv[0] == '+') { - when = switch_timestamp(NULL) + atol(argv[0] + 1); + when = switch_epoch_time_now(NULL) + atol(argv[0] + 1); } else { when = atol(argv[0]); } @@ -2205,7 +2205,7 @@ switch_safe_free(cmd); if (api_task->recur) { - task->runtime = switch_timestamp(NULL) + api_task->recur; + task->runtime = switch_epoch_time_now(NULL) + api_task->recur; } @@ -2252,10 +2252,10 @@ if (*tm == '+') { - when = switch_timestamp(NULL) + atol(tm + 1); + when = switch_epoch_time_now(NULL) + atol(tm + 1); } else if (*tm == '@') { recur = (uint32_t) atol(tm + 1); - when = switch_timestamp(NULL) + recur; + when = switch_epoch_time_now(NULL) + recur; } else { when = atol(tm); } Modified: freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c ============================================================================== --- freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c (original) +++ freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c Sun Jan 25 15:23:07 2009 @@ -473,7 +473,7 @@ time_t when; if (*argv[0] == '+') { - when = switch_timestamp(NULL) + atol(argv[0] + 1); + when = switch_epoch_time_now(NULL) + atol(argv[0] + 1); } else { when = atol(argv[0]); } @@ -498,7 +498,7 @@ switch_bool_t bleg = SWITCH_FALSE; if (*argv[0] == '+') { - when = switch_timestamp(NULL) + atol(argv[0] + 1); + when = switch_epoch_time_now(NULL) + atol(argv[0] + 1); } else { when = atol(argv[0]); } @@ -530,7 +530,7 @@ switch_media_flag_t flags = SMF_NONE; if (*argv[0] == '+') { - when = switch_timestamp(NULL) + atol(argv[0] + 1); + when = switch_epoch_time_now(NULL) + atol(argv[0] + 1); } else { when = atol(argv[0]); } @@ -981,7 +981,7 @@ switch_time_exp_t tm; char date[80] = ""; - switch_time_exp_lt(&tm, switch_timestamp_now()); + switch_time_exp_lt(&tm, switch_micro_time_now()); switch_strftime(date, &retsize, sizeof(date), argv[1], &tm); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SET [%s]=[%s]\n", argv[0], date); switch_channel_set_variable(switch_core_session_get_channel(session), argv[0], date); @@ -993,7 +993,7 @@ switch_time_t out; if (switch_strlen_zero(cmd)) { - out = switch_timestamp_now(); + out = switch_micro_time_now(); } else { out = switch_str_time(cmd); } @@ -1014,7 +1014,7 @@ thetime = switch_time_make(atoi(cmd), 0); cmd = p + 1; } else { - thetime = switch_timestamp_now(); + thetime = switch_micro_time_now(); } switch_time_exp_lt(&tm, thetime); if (switch_strlen_zero(cmd)) { @@ -1207,12 +1207,12 @@ uint32_t mto; if (*argv[3] == '+') { if ((mto = atol(argv[3] + 1)) > 0) { - to = switch_timestamp(NULL) + mto; + to = switch_epoch_time_now(NULL) + mto; } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "INVALID Timeout!\n"); } } else { - if ((to = atol(argv[3])) < switch_timestamp(NULL)) { + if ((to = atol(argv[3])) < switch_epoch_time_now(NULL)) { if (to >= 1) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "INVALID Timeout!\n"); } Modified: freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c ============================================================================== --- freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c (original) +++ freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c Sun Jan 25 15:23:07 2009 @@ -531,7 +531,7 @@ tv.tv_sec = i; tv.tv_usec = 0; i = select((int) (fd + 1), &fds, 0, 0, &tv); - now = switch_timestamp(NULL); + now = switch_epoch_time_now(NULL); if (i > 0) { dns_ioevent(nctx, now); } Modified: freeswitch/trunk/src/mod/applications/mod_esf/mod_esf.c ============================================================================== --- freeswitch/trunk/src/mod/applications/mod_esf/mod_esf.c (original) +++ freeswitch/trunk/src/mod/applications/mod_esf/mod_esf.c Sun Jan 25 15:23:07 2009 @@ -205,7 +205,7 @@ } } - control_packet.unique_id = htonl((u_long) switch_timestamp(NULL)); + control_packet.unique_id = htonl((u_long) switch_epoch_time_now(NULL)); control_packet.command = htonl(LS_START_BCAST); control_packet.ip = inet_addr(mcast_ip); control_packet.port = htonl(mcast_port); @@ -233,7 +233,7 @@ } } - control_packet.unique_id = htonl((u_long) switch_timestamp(NULL)); + control_packet.unique_id = htonl((u_long) switch_epoch_time_now(NULL)); control_packet.command = htonl(LS_STOP_BCAST); bytes = 8; switch_socket_sendto(socket, control_packet_addr, 0, (void *) &control_packet, &bytes); Modified: freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c ============================================================================== --- freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c (original) +++ freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c Sun Jan 25 15:23:07 2009 @@ -195,7 +195,7 @@ return SWITCH_STATUS_SUCCESS; } - if (cd->total && switch_timestamp(NULL) >= cd->next) { + if (cd->total && switch_epoch_time_now(NULL) >= cd->next) { if (cd->index == MAX_CHIME || cd->index == cd->total || !cd->list[cd->index]) { cd->index = 0; } @@ -213,10 +213,10 @@ cd->abort = 1; return SWITCH_STATUS_FALSE; } - cd->next = switch_timestamp(NULL) + cd->freq; + cd->next = switch_epoch_time_now(NULL) + cd->freq; cd->index++; } - } else if (cd->orbit_timeout && switch_timestamp(NULL) >= cd->orbit_timeout) { + } else if (cd->orbit_timeout && switch_epoch_time_now(NULL) >= cd->orbit_timeout) { cd->do_orbit = 1; return SWITCH_STATUS_FALSE; } @@ -418,7 +418,7 @@ if (state == CS_HANGUP || state == CS_ROUTING) { if ((uuid = switch_channel_get_variable(channel, "fifo_outbound_uuid"))) { switch_snprintf(sql, sizeof(sql), "update fifo_outbound set use_count=use_count-1, outbound_call_count=outbound_call_count+1, next_avail=%ld + lag where uuid='%s'", - (long)switch_timestamp(NULL), uuid); + (long)switch_epoch_time_now(NULL), uuid); fifo_execute_sql(sql, globals.sql_mutex); } @@ -451,7 +451,7 @@ if (switch_ivr_originate(NULL, &session, &cause, h->originate_string, h->timeout, NULL, NULL, NULL, NULL, NULL, SOF_NONE) != SWITCH_STATUS_SUCCESS) { switch_snprintf(sql, sizeof(sql), "update fifo_outbound set use_count=use_count-1, outbound_fail_count=outbound_fail_count+1, next_avail=%ld + lag where uuid='%s'", - (long)switch_timestamp(NULL), h->uuid); + (long)switch_epoch_time_now(NULL), h->uuid); fifo_execute_sql(sql, globals.sql_mutex); goto end; } @@ -512,7 +512,7 @@ sql = switch_mprintf("select uuid, fifo_name, originate_string, simo_count, use_count, timeout, lag, " "next_avail, expires, static, outbound_call_count, outbound_fail_count, hostname " "from fifo_outbound where (use_count < simo_count) and (next_avail = 0 or next_avail <= %ld) order by outbound_call_count", - (long) switch_timestamp(NULL)); + (long) switch_epoch_time_now(NULL)); switch_assert(sql); fifo_execute_sql_callback(globals.sql_mutex, sql, place_call_callback, &need); free(sql); @@ -668,7 +668,7 @@ switch_event_t *event = NULL; char date[80] = ""; switch_time_exp_t tm; - switch_time_t ts = switch_timestamp_now(); + switch_time_t ts = switch_micro_time_now(); switch_size_t retsize; char *list_string; int nlist_count; @@ -796,7 +796,7 @@ to = 60; } } - cd.orbit_timeout = switch_timestamp(NULL) + to; + cd.orbit_timeout = switch_epoch_time_now(NULL) + to; } } @@ -823,7 +823,7 @@ } if (!node_consumer_wait_count(node)) { - node->start_waiting = switch_timestamp_now(); + node->start_waiting = switch_micro_time_now(); } if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) { @@ -843,7 +843,7 @@ switch_mutex_unlock(node->mutex); - ts = switch_timestamp_now(); + ts = switch_micro_time_now(); switch_time_exp_lt(&tm, ts); switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm); switch_channel_set_variable(channel, "fifo_status", "WAITING"); @@ -856,7 +856,7 @@ char *list_dup = switch_core_session_strdup(session, chime_list); cd.total = switch_separate_string(list_dup, ',', cd.list, (sizeof(cd.list) / sizeof(cd.list[0]))); cd.freq = freq; - cd.next = switch_timestamp(NULL) + cd.freq; + cd.next = switch_epoch_time_now(NULL) + cd.freq; } send_presence(node); @@ -930,7 +930,7 @@ switch_channel_set_state(channel, CS_HIBERNATE); goto done; } else { - ts = switch_timestamp_now(); + ts = switch_micro_time_now(); switch_time_exp_lt(&tm, ts); switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm); switch_channel_set_variable(channel, "fifo_status", cd.do_orbit ? "TIMEOUT" : "ABORTED"); @@ -1027,7 +1027,7 @@ switch_event_fire(&event); } - ts = switch_timestamp_now(); + ts = switch_micro_time_now(); switch_time_exp_lt(&tm, ts); switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm); switch_channel_set_variable(channel, "fifo_status", "WAITING"); @@ -1220,7 +1220,7 @@ switch_assert(cloned_profile->next == NULL); switch_channel_set_originatee_caller_profile(channel, cloned_profile); - ts = switch_timestamp_now(); + ts = switch_micro_time_now(); switch_time_exp_lt(&tm, ts); switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm); switch_channel_set_variable(channel, "fifo_status", "TALKING"); @@ -1251,7 +1251,7 @@ } } - ts = switch_timestamp_now(); + ts = switch_micro_time_now(); switch_time_exp_lt(&tm, ts); switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm); switch_channel_set_variable(channel, "fifo_status", "WAITING"); @@ -1300,7 +1300,7 @@ } if (fifo_consumer_wrapup_time) { - wrapup_time_started = switch_timestamp_now(); + wrapup_time_started = switch_micro_time_now(); } if (!switch_strlen_zero(fifo_consumer_wrapup_key) && strcmp(buf, fifo_consumer_wrapup_key)) { @@ -1308,7 +1308,7 @@ char terminator = 0; if (fifo_consumer_wrapup_time) { - wrapup_time_elapsed = (switch_timestamp_now() - wrapup_time_started) / 1000; + wrapup_time_elapsed = (switch_micro_time_now() - wrapup_time_started) / 1000; if (wrapup_time_elapsed > fifo_consumer_wrapup_time) { break; } else { @@ -1324,7 +1324,7 @@ } } else if (fifo_consumer_wrapup_time && (switch_strlen_zero(fifo_consumer_wrapup_key) || !strcmp(buf, fifo_consumer_wrapup_key))) { while(switch_channel_ready(channel)) { - wrapup_time_elapsed = (switch_timestamp_now() - wrapup_time_started) / 1000; + wrapup_time_elapsed = (switch_micro_time_now() - wrapup_time_started) / 1000; if (wrapup_time_elapsed > fifo_consumer_wrapup_time) { break; } @@ -1949,7 +1949,7 @@ lag = atoi(argv[5]); } if (argc > 6) { - expires = switch_timestamp(NULL) + atoi(argv[6]); + expires = switch_epoch_time_now(NULL) + atoi(argv[6]); } if (simo_count < 0) { simo_count = 1; Modified: freeswitch/trunk/src/mod/applications/mod_fsv/mod_fsv.c ============================================================================== --- freeswitch/trunk/src/mod/applications/mod_fsv/mod_fsv.c (original) +++ freeswitch/trunk/src/mod/applications/mod_fsv/mod_fsv.c Sun Jan 25 15:23:07 2009 @@ -140,7 +140,7 @@ vid_codec = switch_core_session_get_video_read_codec(session); h.version = VERSION; - h.created = switch_timestamp_now(); + h.created = switch_micro_time_now(); switch_set_string(h.video_codec_name, vid_codec->implementation->iananame); if (vid_codec->fmtp_in) { switch_set_string(h.video_fmtp, vid_codec->fmtp_in); Modified: freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c ============================================================================== --- freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c (original) +++ freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c Sun Jan 25 15:23:07 2009 @@ -811,7 +811,7 @@ char *szinterval = NULL; limit_hash_item_t *item = NULL; switch_channel_t *channel = switch_core_session_get_channel(session); - time_t now = switch_timestamp(NULL); + time_t now = switch_epoch_time_now(NULL); switch_hash_t *channel_hash = NULL; uint8_t increment = 1; uint8_t new_channel = 0; Modified: freeswitch/trunk/src/mod/applications/mod_rss/mod_rss.c ============================================================================== --- freeswitch/trunk/src/mod/applications/mod_rss/mod_rss.c (original) +++ freeswitch/trunk/src/mod/applications/mod_rss/mod_rss.c Sun Jan 25 15:23:07 2009 @@ -478,7 +478,7 @@ switch_size_t retsize; char dtmf[5] = ""; - switch_time_exp_lt(&tm, switch_timestamp_now()); + switch_time_exp_lt(&tm, switch_micro_time_now()); switch_strftime_nocheck(date, &retsize, sizeof(date), "%I:%M %p", &tm); Modified: freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c ============================================================================== --- freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c (original) +++ freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c Sun Jan 25 15:23:07 2009 @@ -1767,7 +1767,7 @@ } } switch_snprintf(sql, sizeof(sql), "update voicemail_msgs set read_epoch=%ld where username='%s' and domain='%s' and flags='save'", - (long) switch_timestamp(NULL), myid, domain_name); + (long) switch_epoch_time_now(NULL), myid, domain_name); vm_execute_sql(profile, sql, profile->mutex); switch_snprintf(sql, sizeof(sql), "select file_path from voicemail_msgs where username='%s' and domain='%s' and flags='delete'", myid, domain_name); @@ -2309,11 +2309,11 @@ switch_event_add_header_string(message_event, SWITCH_STACK_BOTTOM, "VM-Flags", read_flags); switch_event_add_header_string(message_event, SWITCH_STACK_BOTTOM, "VM-Folder", myfolder); switch_event_add_header(message_event, SWITCH_STACK_BOTTOM, "VM-Message-Len", "%u", message_len); - switch_event_add_header(message_event, SWITCH_STACK_BOTTOM, "VM-Timestamp", "%lu", (unsigned long) switch_timestamp(NULL)); + switch_event_add_header(message_event, SWITCH_STACK_BOTTOM, "VM-Timestamp", "%lu", (unsigned long) switch_epoch_time_now(NULL)); switch_event_fire(&message_event); - usql = switch_mprintf("insert into voicemail_msgs values(%ld,0,'%q','%q','%q','%q','%q','%q','%q','%u','','%q')", (long) switch_timestamp(NULL), + usql = switch_mprintf("insert into voicemail_msgs values(%ld,0,'%q','%q','%q','%q','%q','%q','%q','%u','','%q')", (long) switch_epoch_time_now(NULL), myid, domain_name, uuid_str, caller_id_name, caller_id_number, myfolder, file_path, message_len, read_flags); @@ -2346,7 +2346,7 @@ &total_new_urgent_messages, &total_saved_urgent_messages); if (switch_strlen_zero(vm_timezone) || (switch_strftime_tz(vm_timezone, profile->date_fmt, date, sizeof(date), 0) != SWITCH_STATUS_SUCCESS)) { - switch_time_exp_lt(&tm, switch_timestamp_now()); + switch_time_exp_lt(&tm, switch_micro_time_now()); switch_strftime(date, &retsize, sizeof(date), profile->date_fmt, &tm); } @@ -2696,7 +2696,7 @@ switch_time_exp_t tm; char date[80] = ""; switch_size_t retsize; - switch_time_t ts = switch_timestamp_now(); + switch_time_t ts = switch_micro_time_now(); char *dbuf = NULL; char *vm_storage_dir = NULL; char *record_macro = VM_RECORD_MESSAGE_MACRO; @@ -3271,7 +3271,7 @@ struct holder holder; sql = switch_mprintf("update voicemail_msgs set read_epoch=%ld where username='%s' and domain='%s' and file_path like '%%%s'", - (long) switch_timestamp(NULL), user, domain, file); + (long) switch_epoch_time_now(NULL), user, domain, file); vm_execute_sql(profile, sql, profile->mutex); free(sql); Modified: freeswitch/trunk/src/mod/endpoints/mod_alsa/mod_alsa.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_alsa/mod_alsa.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_alsa/mod_alsa.c Sun Jan 25 15:23:07 2009 @@ -180,7 +180,7 @@ assert(channel != NULL); - last = switch_timestamp_now() - waitsec; + last = switch_micro_time_now() - waitsec; @@ -243,7 +243,7 @@ switch_channel_mark_ring_ready(channel); while (switch_channel_get_state(channel) == CS_INIT && !switch_test_flag(tech_pvt, TFLAG_ANSWER)) { - if (switch_timestamp_now() - last >= waitsec) { + if (switch_micro_time_now() - last >= waitsec) { char buf[512]; switch_event_t *event; @@ -257,7 +257,7 @@ } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s\n", buf); - last = switch_timestamp_now(); + last = switch_micro_time_now(); if (ring_file) { unsigned int pos = 0; switch_core_file_seek(&fh, &pos, 0, SEEK_SET); Modified: freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c Sun Jan 25 15:23:07 2009 @@ -1070,7 +1070,7 @@ switch_set_flag_locked(tech_pvt, TFLAG_IO); - started = switch_timestamp_now(); + started = switch_micro_time_now(); /* jingle has no ringing indication so we will just pretend that we got one */ switch_core_session_queue_indication(session, SWITCH_MESSAGE_INDICATE_RINGING); @@ -1088,7 +1088,7 @@ switch_test_flag(tech_pvt, TFLAG_RTP_READY) && switch_test_flag(tech_pvt, TFLAG_ANSWER) && switch_test_flag(tech_pvt, TFLAG_TRANSPORT_ACCEPT) && tech_pvt->remote_ip && tech_pvt->remote_port && switch_test_flag(tech_pvt, TFLAG_TRANSPORT))) { - now = switch_timestamp_now(); + now = switch_micro_time_now(); elapsed = (unsigned int) ((now - started) / 1000); if (switch_channel_get_state(channel) >= CS_HANGUP || switch_test_flag(tech_pvt, TFLAG_BYE)) { @@ -1340,7 +1340,7 @@ #if 0 if (tech_pvt->last_read) { - elapsed = (unsigned int) ((switch_timestamp_now() - tech_pvt->last_read) / 1000); + elapsed = (unsigned int) ((switch_micro_time_now() - tech_pvt->last_read) / 1000); if (elapsed > 60000) { return SWITCH_STATUS_TIMEOUT; } @@ -1368,7 +1368,7 @@ payload = tech_pvt->read_frame.payload; #if 0 - elapsed = (unsigned int) ((switch_timestamp_now() - started) / 1000); + elapsed = (unsigned int) ((switch_micro_time_now() - started) / 1000); if (timeout > -1) { if (elapsed >= (unsigned int) timeout) { @@ -1376,7 +1376,7 @@ } } - elapsed = (unsigned int) ((switch_timestamp_now() - last_act) / 1000); + elapsed = (unsigned int) ((switch_micro_time_now() - last_act) / 1000); if (elapsed >= hard_timeout) { return SWITCH_STATUS_BREAK; } Modified: freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c Sun Jan 25 15:23:07 2009 @@ -182,7 +182,7 @@ switch_assert(tech_pvt != NULL); - last = switch_timestamp_now() - waitsec; + last = switch_micro_time_now() - waitsec; if ((val = switch_channel_get_variable(channel, "pa_hold_file"))) { hold_file = val; @@ -251,7 +251,7 @@ while (switch_channel_get_state(channel) == CS_INIT && !switch_test_flag(tech_pvt, TFLAG_ANSWER)) { switch_size_t olen = globals.timer.samples; - if (switch_timestamp_now() - last >= waitsec) { + if (switch_micro_time_now() - last >= waitsec) { char buf[512]; switch_event_t *event; @@ -264,7 +264,7 @@ switch_event_fire(&event); } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s\n", buf); - last = switch_timestamp_now(); + last = switch_micro_time_now(); } if (ring_file) { @@ -449,7 +449,7 @@ if (globals.call_list) { switch_set_flag_locked(globals.call_list, TFLAG_MASTER); } else { - globals.deactivate_timer = switch_timestamp(NULL) + 2; + globals.deactivate_timer = switch_epoch_time_now(NULL) + 2; deactivate_audio_device(); } @@ -1259,7 +1259,7 @@ int codec_ms = globals.codec_ms; switch_mutex_lock(globals.device_lock); - while (globals.deactivate_timer > switch_timestamp(NULL)) { + while (globals.deactivate_timer > switch_epoch_time_now(NULL)) { switch_yield(1000000); } switch_mutex_unlock(globals.device_lock); Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Sun Jan 25 15:23:07 2009 @@ -1650,7 +1650,7 @@ switch_assert(gp->state < REG_STATE_LAST); stream->write_function(stream, "%25s\t%s\t %32s\t%s", gp->name, "gateway", gp->register_to, sofia_state_names[gp->state]); if (gp->state == REG_STATE_FAILED || gp->state == REG_STATE_TRYING) { - time_t now = switch_timestamp(NULL); + time_t now = switch_epoch_time_now(NULL); if (gp->retry > now) { stream->write_function(stream, " (retry: %ds)", gp->retry - now); } else { @@ -1842,7 +1842,7 @@ switch_assert(gp->state < REG_STATE_LAST); stream->write_function(stream, "<gateway>\n<Name>%s</Name>\n<Type>%s</Type>\n<Data>%s</Data>\n<State>%s</State>\n</gateway>\n", gp->name, "gateway", gp->register_to, sofia_state_names[gp->state]); if (gp->state == REG_STATE_FAILED || gp->state == REG_STATE_TRYING) { - time_t now = switch_timestamp(NULL); + time_t now = switch_epoch_time_now(NULL); if (gp->retry > now) { stream->write_function(stream, " (retry: %ds)", gp->retry - now); } else { @@ -2042,7 +2042,7 @@ if (!strcasecmp(argv[1], "stop") || !strcasecmp(argv[1], "restart")) { int rsec = 10; - int diff = (int) (switch_timestamp(NULL) - profile->started); + int diff = (int) (switch_epoch_time_now(NULL) - profile->started); int remain = rsec - diff; if (diff < rsec) { stream->write_function(stream, "Profile %s must be up for at least %d seconds to stop/restart.\nPlease wait %d second%s\n", Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c Sun Jan 25 15:23:07 2009 @@ -284,11 +284,11 @@ void sofia_wait_for_reply(struct private_object *tech_pvt, nua_event_t event, uint32_t timeout) { - time_t exp = switch_timestamp(NULL) + timeout; + time_t exp = switch_epoch_time_now(NULL) + timeout; tech_pvt->want_event = event; - while(switch_channel_ready(tech_pvt->channel) && tech_pvt->want_event && switch_timestamp(NULL) < exp) { + while(switch_channel_ready(tech_pvt->channel) && tech_pvt->want_event && switch_epoch_time_now(NULL) < exp) { switch_yield(100000); } @@ -522,7 +522,7 @@ char *rpid = switch_event_get_header(event, "orig-rpid"); char *call_id = switch_event_get_header(event, "orig-call-id"); char *user_agent = switch_event_get_header(event, "user-agent"); - long expires = (long) switch_timestamp(NULL); + long expires = (long) switch_epoch_time_now(NULL); char *profile_name = switch_event_get_header(event, "orig-profile-name"); char *to_user = switch_event_get_header(event, "orig-to-user"); char *presence_hosts = switch_event_get_header(event, "presence-hosts"); @@ -601,12 +601,12 @@ if (++loops >= 100) { if (++ireg_loops >= IREG_SECONDS) { - sofia_reg_check_expire(profile, switch_timestamp(NULL), 0); + sofia_reg_check_expire(profile, switch_epoch_time_now(NULL), 0); ireg_loops = 0; } if (++gateway_loops >= GATEWAY_SECONDS) { - sofia_reg_check_gateway(profile, switch_timestamp(NULL)); + sofia_reg_check_gateway(profile, switch_epoch_time_now(NULL)); gateway_loops = 0; } sofia_sub_check_gateway(profile, time(NULL)); @@ -778,7 +778,7 @@ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Starting thread for %s\n", profile->name); - profile->started = switch_timestamp(NULL); + profile->started = switch_epoch_time_now(NULL); sofia_set_pflag_locked(profile, PFLAG_RUNNING); launch_sofia_worker_thread(profile); @@ -1104,7 +1104,7 @@ if (ping_freq) { if (ping_freq >= 5) { gateway->ping_freq = ping_freq; - gateway->ping = switch_timestamp(NULL) + ping_freq; + gateway->ping = switch_epoch_time_now(NULL) + ping_freq; } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERROR: invalid ping!\n"); } @@ -2350,12 +2350,12 @@ gateway->state = REG_STATE_FAILED; } } - gateway->ping = switch_timestamp(NULL) + gateway->ping_freq; + gateway->ping = switch_epoch_time_now(NULL) + gateway->ping_freq; sofia_reg_release_gateway(gateway); gateway->pinging = 0; } else if ((profile->pflags & PFLAG_UNREG_OPTIONS_FAIL) && status != 200 && sip && sip->sip_to) { char *sql; - time_t now = switch_timestamp(NULL); + time_t now = switch_epoch_time_now(NULL); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Expire registration '%s@%s' due to options failure\n", sip->sip_to->a_url->url_user, sip->sip_to->a_url->url_host); Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Sun Jan 25 15:23:07 2009 @@ -55,7 +55,7 @@ } if (!tech_pvt->owner_id) { - tech_pvt->owner_id = (uint32_t) switch_timestamp(NULL) - port; + tech_pvt->owner_id = (uint32_t) switch_epoch_time_now(NULL) - port; } if (!tech_pvt->session_id) { @@ -145,7 +145,7 @@ } if (!tech_pvt->owner_id) { - tech_pvt->owner_id = (uint32_t) switch_timestamp(NULL) - port; + tech_pvt->owner_id = (uint32_t) switch_epoch_time_now(NULL) - port; } if (!tech_pvt->session_id) { @@ -2902,7 +2902,7 @@ switch_hash_this(hi, &var, NULL, &val); if ((pptr = (sofia_profile_t *) val)) { int rsec = 10; - int diff = (int) (switch_timestamp(NULL) - pptr->started); + int diff = (int) (switch_epoch_time_now(NULL) - pptr->started); int remain = rsec - diff; if (sofia_test_pflag(pptr, PFLAG_RESPAWN) || !sofia_test_pflag(pptr, PFLAG_RUNNING)) { continue; Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c Sun Jan 25 15:23:07 2009 @@ -946,7 +946,7 @@ char *open; char *prpid; const char *ct = "no/idea"; - time_t exptime = switch_timestamp(NULL) + 3600; + time_t exptime = switch_epoch_time_now(NULL) + 3600; int is_dialog = 0; sofia_profile_t *ext_profile = NULL, *profile = helper->profile; char sstr[128] = ""; @@ -990,7 +990,7 @@ if (expires) { long tmp = atol(expires); if (tmp > 0) { - exptime = tmp - switch_timestamp(NULL) - SUB_OVERLAP; + exptime = tmp - switch_epoch_time_now(NULL) - SUB_OVERLAP; } else { exptime = tmp; } @@ -1281,7 +1281,7 @@ } id = switch_mprintf("sip:%s@%s", sub_to_user, sub_to_host); - expire_sec = (int) (expire_sec - switch_timestamp(NULL)); + expire_sec = (int) (expire_sec - switch_epoch_time_now(NULL)); if (expire_sec < 0) { expire_sec = 3600; } @@ -1585,7 +1585,7 @@ exp_delta = profile->force_subscription_expires ? profile->force_subscription_expires : (sip->sip_expires ? sip->sip_expires->ex_delta : 3600); if (exp_delta) { - exp_abs = (long) switch_timestamp(NULL) + exp_delta; + exp_abs = (long) switch_epoch_time_now(NULL) + exp_delta; } else { exp_abs = 0; sub_state = nua_substate_terminated; @@ -1859,7 +1859,7 @@ } exp_delta = (sip->sip_expires ? sip->sip_expires->ex_delta : 3600); - exp = (long) switch_timestamp(NULL) + exp_delta; + exp = (long) switch_epoch_time_now(NULL) + exp_delta; if ((sql = switch_mprintf("delete from sip_presence where sip_user='%q' and sip_host='%q' " Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Sun Jan 25 15:23:07 2009 @@ -612,7 +612,7 @@ switch_uuid_format(uuid_str, &uuid); sql = switch_mprintf("insert into sip_authentication (nonce,expires,profile_name,hostname) " - "values('%q', %ld, '%q', '%q')", uuid_str, switch_timestamp(NULL) + profile->nonce_ttl, profile->name, mod_sofia_globals.hostname); + "values('%q', %ld, '%q', '%q')", uuid_str, switch_epoch_time_now(NULL) + profile->nonce_ttl, profile->name, mod_sofia_globals.hostname); switch_assert(sql != NULL); sofia_glue_actually_execute_sql(profile, SWITCH_FALSE, sql, profile->ireg_mutex); switch_safe_free(sql); @@ -940,7 +940,7 @@ "(call_id,sip_user,sip_host,presence_hosts,contact,status,rpid,expires,user_agent,server_user,server_host,profile_name,hostname) " "values ('%q','%q', '%q','%q','%q','%q', '%q', %ld, '%q', '%q', '%q', '%q', '%q')", call_id, to_user, reg_host, profile->presence_hosts ? profile->presence_hosts : reg_host, - contact_str, reg_desc, rpid, (long) switch_timestamp(NULL) + (long) exptime * 2, + contact_str, reg_desc, rpid, (long) switch_epoch_time_now(NULL) + (long) exptime * 2, agent, from_user, guess_ip4, profile->name, mod_sofia_globals.hostname); if (sql) { @@ -1091,7 +1091,7 @@ } } - switch_rfc822_date(date, switch_timestamp_now()); + switch_rfc822_date(date, switch_micro_time_now()); nua_respond(nh, SIP_200_OK, SIPTAG_CONTACT(sip->sip_contact), TAG_IF(path_val, SIPTAG_PATH_STR(path_val)), NUTAG_WITH_THIS(nua), Modified: freeswitch/trunk/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c ============================================================================== --- freeswitch/trunk/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c (original) +++ freeswitch/trunk/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c Sun Jan 25 15:23:07 2009 @@ -99,7 +99,7 @@ fd->fd = -1; if (globals.rotate) { - switch_time_exp_lt(&tm, switch_timestamp_now()); + switch_time_exp_lt(&tm, switch_micro_time_now()); switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d-%H-%M-%S", &tm); len = strlen(fd->path) + strlen(date) + 2; Modified: freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c ============================================================================== --- freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c (original) +++ freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c Sun Jan 25 15:23:07 2009 @@ -196,7 +196,7 @@ continue; } - if (switch_test_flag(l, LFLAG_STATEFUL) && l->timeout && switch_timestamp(NULL) - l->last_flush > l->timeout) { + if (switch_test_flag(l, LFLAG_STATEFUL) && l->timeout && switch_epoch_time_now(NULL) - l->last_flush > l->timeout) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Stateful Listener %u has expired\n", l->id); remove_listener(l); expire_listener(&l); Modified: freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c ============================================================================== --- freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c (original) +++ freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c Sun Jan 25 15:23:07 2009 @@ -231,7 +231,7 @@ continue; } - if (switch_test_flag(l, LFLAG_STATEFUL) && l->timeout && switch_timestamp(NULL) - l->last_flush > l->timeout) { + if (switch_test_flag(l, LFLAG_STATEFUL) && l->timeout && switch_epoch_time_now(NULL) - l->last_flush > l->timeout) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Stateful Listener %u has expired\n", l->id); remove_listener(l); expire_listener(&l); @@ -718,7 +718,7 @@ switch_thread_rwlock_create(&listener->rwlock, listener->pool); listener->id = next_id(); listener->timeout = 60; - listener->last_flush = switch_timestamp(NULL); + listener->last_flush = switch_epoch_time_now(NULL); if (events) { char delim = ','; @@ -820,7 +820,7 @@ goto end; } - listener->last_flush = switch_timestamp(NULL); + listener->last_flush = switch_epoch_time_now(NULL); stream->write_function(stream, "<data>\n <reply type=\"success\">Current Events Follow</reply>\n"); xmlize_listener(listener, stream); @@ -963,7 +963,7 @@ int clen = 0; *event = NULL; - start = switch_timestamp(NULL); + start = switch_epoch_time_now(NULL); ptr = mbuf; @@ -1074,7 +1074,7 @@ } if (timeout) { - elapsed = (uint32_t) (switch_timestamp(NULL) - start); + elapsed = (uint32_t) (switch_epoch_time_now(NULL) - start); if (elapsed >= timeout) { switch_clear_flag_locked(listener, LFLAG_RUNNING); return SWITCH_STATUS_FALSE; Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c ============================================================================== --- freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c (original) +++ freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c Sun Jan 25 15:23:07 2009 @@ -2118,7 +2118,7 @@ channel = switch_core_session_get_channel(jss->session); CHANNEL_MEDIA_SANITY_CHECK(); - started = switch_timestamp_now(); + started = switch_micro_time_now(); if (argc > 0) { JS_ValueToInt32(cx, argv[0], &timeout); @@ -2132,7 +2132,7 @@ } saveDepth = JS_SuspendRequest(cx); for (;;) { - if (((elapsed = (unsigned int) ((switch_timestamp_now() - started) / 1000)) > (switch_time_t) timeout) + if (((elapsed = (unsigned int) ((switch_micro_time_now() - started) / 1000)) > (switch_time_t) timeout) || switch_channel_get_state(channel) >= CS_HANGUP) { *rval = BOOLEAN_TO_JSVAL(JS_FALSE); break; @@ -2165,7 +2165,7 @@ METHOD_SANITY_CHECK(); channel = switch_core_session_get_channel(jss->session); - started = switch_timestamp_now(); + started = switch_micro_time_now(); if (argc > 0) { JS_ValueToInt32(cx, argv[0], &timeout); @@ -2180,7 +2180,7 @@ saveDepth = JS_SuspendRequest(cx); for (;;) { - if (((elapsed = (unsigned int) ((switch_timestamp_now() - started) / 1000)) > (switch_time_t) timeout) + if (((elapsed = (unsigned int) ((switch_micro_time_now() - started) / 1000)) > (switch_time_t) timeout) || switch_channel_get_state(channel) >= CS_HANGUP) { *rval = BOOLEAN_TO_JSVAL(JS_FALSE); break; Modified: freeswitch/trunk/src/mod/loggers/mod_logfile/mod_logfile.c ============================================================================== --- freeswitch/trunk/src/mod/loggers/mod_logfile/mod_logfile.c (original) +++ freeswitch/trunk/src/mod/loggers/mod_logfile/mod_logfile.c Sun Jan 25 15:23:07 2009 @@ -124,7 +124,7 @@ switch_mutex_lock(globals.mutex); - switch_time_exp_lt(&tm, switch_timestamp_now()); + switch_time_exp_lt(&tm, switch_micro_time_now()); switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d-%H-%M-%S", &tm); profile->log_size = 0; Modified: freeswitch/trunk/src/mod/say/mod_say_de/mod_say_de.c ============================================================================== --- freeswitch/trunk/src/mod/say/mod_say_de/mod_say_de.c (original) +++ freeswitch/trunk/src/mod/say/mod_say_de/mod_say_de.c Sun Jan 25 15:23:07 2009 @@ -303,7 +303,7 @@ } } else { if ((seconds = atoi(tosay)) <= 0) { - seconds = (int64_t) switch_timestamp(NULL); + seconds = (int64_t) switch_epoch_time_now(NULL); } if (seconds >= 60) { @@ -361,7 +361,7 @@ if ((t = atoi(tosay)) > 0) { target = switch_time_make(t, 0); } else { - target = switch_timestamp_now(); + target = switch_micro_time_now(); } switch_time_exp_lt(&tm, target); Modified: freeswitch/trunk/src/mod/say/mod_say_en/mod_say_en.c ============================================================================== --- freeswitch/trunk/src/mod/say/mod_say_en/mod_say_en.c (original) +++ freeswitch/trunk/src/mod/say/mod_say_en/mod_say_en.c Sun Jan 25 15:23:07 2009 @@ -294,7 +294,7 @@ } } else { if ((seconds = atol(tosay)) <= 0) { - seconds = (int64_t) switch_timestamp(NULL); + seconds = (int64_t) switch_epoch_time_now(NULL); } if (seconds >= 60) { @@ -352,7 +352,7 @@ if ((t = atol(tosay)) > 0) { target = switch_time_make(t, 0); } else { - target = switch_timestamp_now(); + target = switch_micro_time_now(); } if (tz) { Modified: freeswitch/trunk/src/mod/say/mod_say_es/mod_say_es.c ============================================================================== --- freeswitch/trunk/src/mod/say/mod_say_es/mod_say_es.c (original) +++ freeswitch/trunk/src/mod/say/mod_say_es/mod_say_es.c Sun Jan 25 15:23:07 2009 @@ -292,7 +292,7 @@ } } else { if ((seconds = atoi(tosay)) <= 0) { - seconds = (int64_t) switch_timestamp(NULL); + seconds = (int64_t) switch_epoch_time_now(NULL); } if (seconds >= 60) { @@ -350,7 +350,7 @@ if ((t = atoi(tosay)) > 0) { target = switch_time_make(t, 0); } else { - target = switch_timestamp_now(); + target = switch_micro_time_now(); } switch_time_exp_lt(&tm, target); Modified: freeswitch/trunk/src/mod/say/mod_say_fr/mod_say_fr.c ============================================================================== --- freeswitch/trunk/src/mod/say/mod_say_fr/mod_say_fr.c (original) +++ freeswitch/trunk/src/mod/say/mod_say_fr/mod_say_fr.c Sun Jan 25 15:23:07 2009 @@ -292,7 +292,7 @@ } } else { if ((seconds = atoi(tosay)) <= 0) { - seconds = (int64_t) switch_timestamp(NULL); + seconds = (int64_t) switch_epoch_time_now(NULL); } if (seconds >= 60) { @@ -350,7 +350,7 @@ if ((t = atoi(tosay)) > 0) { target = switch_time_make(t, 0); } else { - target = switch_timestamp_now(); + target = switch_micro_time_now(); } switch_time_exp_lt(&tm, target); Modified: freeswitch/trunk/src/mod/say/mod_say_it/mod_say_it.c ============================================================================== --- freeswitch/trunk/src/mod/say/mod_say_it/mod_say_it.c (original) +++ freeswitch/trunk/src/mod/say/mod_say_it/mod_say_it.c Sun Jan 25 15:23:07 2009 @@ -292,7 +292,7 @@ } } else { if ((seconds = atoi(tosay)) <= 0) { - seconds = (int64_t) switch_timestamp(NULL); + seconds = (int64_t) switch_epoch_time_now(NULL); } if (seconds >= 60) { @@ -350,7 +350,7 @@ if ((t = atoi(tosay)) > 0) { target = switch_time_make(t, 0); } else { - target = switch_timestamp_now(); + target = switch_micro_time_now(); } switch_time_exp_lt(&tm, target); Modified: freeswitch/trunk/src/mod/say/mod_say_nl/mod_say_nl.c ============================================================================== --- freeswitch/trunk/src/mod/say/mod_say_nl/mod_say_nl.c (original) +++ freeswitch/trunk/src/mod/say/mod_say_nl/mod_say_nl.c Sun Jan 25 15:23:07 2009 @@ -292,7 +292,7 @@ } } else { if ((seconds = atoi(tosay)) <= 0) { - seconds = (int64_t) switch_timestamp(NULL); + seconds = (int64_t) switch_epoch_time_now(NULL); } if (seconds >= 60) { @@ -350,7 +350,7 @@ if ((t = atoi(tosay)) > 0) { target = switch_time_make(t, 0); } else { - target = switch_timestamp_now(); + target = switch_micro_time_now(); } switch_time_exp_lt(&tm, target); Modified: freeswitch/trunk/src/mod/say/mod_say_zh/mod_say_zh.c ============================================================================== --- freeswitch/trunk/src/mod/say/mod_say_zh/mod_say_zh.c (original) +++ freeswitch/trunk/src/mod/say/mod_say_zh/mod_say_zh.c Sun Jan 25 15:23:07 2009 @@ -367,7 +367,7 @@ } } else { if ((seconds = atoi(tosay)) <= 0) { - seconds = (int64_t) switch_timestamp(NULL); + seconds = (int64_t) switch_epoch_time_now(NULL); } if (seconds >= 60) { @@ -425,7 +425,7 @@ if ((t = atoi(tosay)) > 0) target = switch_time_make(t, 0); else - target = switch_timestamp_now(); + target = switch_micro_time_now(); switch_time_exp_lt(&tm, target); switch (type) { @@ -455,7 +455,7 @@ #if 0 tm = *localtime(&then); - this_morning = switch_timestamp_now(); + this_morning = switch_micro_time_now(); switch_time_exp_lt(&tm2, this_morning); tm2->tm_hour = 0; tm2->tm_min = 0; Modified: freeswitch/trunk/src/switch_channel.c ============================================================================== --- freeswitch/trunk/src/switch_channel.c (original) +++ freeswitch/trunk/src/switch_channel.c Sun Jan 25 15:23:07 2009 @@ -1328,7 +1328,7 @@ } caller_profile->times = (switch_channel_timetable_t *) switch_core_session_alloc(channel->session, sizeof(*caller_profile->times)); - caller_profile->times->profile_created = switch_timestamp_now(); + caller_profile->times->profile_created = switch_micro_time_now(); if (channel->caller_profile && channel->caller_profile->times) { channel->caller_profile->times->transferred = caller_profile->times->profile_created; @@ -1341,7 +1341,7 @@ switch_caller_extension_clone(&caller_profile->caller_extension, channel->caller_profile->caller_extension, caller_profile->pool); } } else { - caller_profile->times->created = switch_timestamp_now(); + caller_profile->times->created = switch_micro_time_now(); } caller_profile->next = channel->caller_profile; @@ -1534,7 +1534,7 @@ if (channel->caller_profile && channel->caller_profile->times && !channel->caller_profile->times->hungup) { switch_mutex_lock(channel->profile_mutex); - channel->caller_profile->times->hungup = switch_timestamp_now(); + channel->caller_profile->times->hungup = switch_micro_time_now(); switch_mutex_unlock(channel->profile_mutex); } @@ -1580,7 +1580,7 @@ switch_channel_set_flag(channel, CF_RING_READY); if (channel->caller_profile && channel->caller_profile->times) { switch_mutex_lock(channel->profile_mutex); - channel->caller_profile->times->progress = switch_timestamp_now(); + channel->caller_profile->times->progress = switch_micro_time_now(); if (channel->caller_profile->originator_caller_profile) { switch_core_session_t *other_session; if ((other_session = switch_core_session_locate(channel->caller_profile->originator_caller_profile->uuid))) { @@ -1638,7 +1638,7 @@ if (channel->caller_profile && channel->caller_profile->times) { switch_mutex_lock(channel->profile_mutex); - channel->caller_profile->times->progress_media = switch_timestamp_now(); + channel->caller_profile->times->progress_media = switch_micro_time_now(); if (channel->caller_profile->originator_caller_profile) { switch_core_session_t *osession; if ((osession = switch_core_session_locate(channel->caller_profile->originator_caller_profile->uuid))) { @@ -1756,7 +1756,7 @@ if (channel->caller_profile && channel->caller_profile->times) { switch_mutex_lock(channel->profile_mutex); - channel->caller_profile->times->answered = switch_timestamp_now(); + channel->caller_profile->times->answered = switch_micro_time_now(); switch_mutex_unlock(channel->profile_mutex); } Modified: freeswitch/trunk/src/switch_console.c ============================================================================== --- freeswitch/trunk/src/switch_console.c (original) +++ freeswitch/trunk/src/switch_console.c Sun Jan 25 15:23:07 2009 @@ -296,7 +296,7 @@ goto done; } - switch_time_exp_lt(&tm, switch_timestamp_now()); + switch_time_exp_lt(&tm, switch_micro_time_now()); switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm); if (channel == SWITCH_CHANNEL_ID_LOG) { Modified: freeswitch/trunk/src/switch_core.c ============================================================================== --- freeswitch/trunk/src/switch_core.c (original) +++ freeswitch/trunk/src/switch_core.c Sun Jan 25 15:23:07 2009 @@ -136,7 +136,7 @@ check_ip(); /* reschedule this task */ - task->runtime = switch_timestamp(NULL) + 20; + task->runtime = switch_epoch_time_now(NULL) + 20; } @@ -1088,7 +1088,7 @@ switch_scheduler_task_thread_start(); runtime.initiated = switch_time_now(); - switch_scheduler_add_task(switch_timestamp(NULL), heartbeat_callback, "heartbeat", "core", 0, NULL, SSHF_NONE | SSHF_NO_DEL); + switch_scheduler_add_task(switch_epoch_time_now(NULL), heartbeat_callback, "heartbeat", "core", 0, NULL, SSHF_NONE | SSHF_NO_DEL); switch_uuid_get(&uuid); switch_uuid_format(runtime.uuid_str, &uuid); @@ -1323,7 +1323,7 @@ SWITCH_DECLARE(switch_time_t) switch_core_uptime(void) { - return switch_timestamp_now() - runtime.initiated; + return switch_micro_time_now() - runtime.initiated; } SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, int32_t *val) Modified: freeswitch/trunk/src/switch_core_io.c ============================================================================== --- freeswitch/trunk/src/switch_core_io.c (original) +++ freeswitch/trunk/src/switch_core_io.c Sun Jan 25 15:23:07 2009 @@ -353,7 +353,7 @@ } } - if (bp->stop_time && bp->stop_time <= switch_timestamp(NULL)) { + if (bp->stop_time && bp->stop_time <= switch_epoch_time_now(NULL)) { ok = SWITCH_FALSE; } @@ -502,7 +502,7 @@ switch_mutex_lock(bp->read_mutex); if (bp->callback) { if (bp->callback(bp, bp->user_data, SWITCH_ABC_TYPE_READ_PING) == SWITCH_FALSE - || (bp->stop_time && bp->stop_time <= switch_timestamp(NULL))) { + || (bp->stop_time && bp->stop_time <= switch_epoch_time_now(NULL))) { ok = SWITCH_FALSE; } } @@ -775,7 +775,7 @@ } } - if (bp->stop_time && bp->stop_time <= switch_timestamp(NULL)) { + if (bp->stop_time && bp->stop_time <= switch_epoch_time_now(NULL)) { ok = SWITCH_FALSE; } Modified: freeswitch/trunk/src/switch_core_port_allocator.c ============================================================================== --- freeswitch/trunk/src/switch_core_port_allocator.c (original) +++ freeswitch/trunk/src/switch_core_port_allocator.c Sun Jan 25 15:23:07 2009 @@ -118,7 +118,7 @@ int odd = switch_test_flag(alloc, SPF_ODD); switch_mutex_lock(alloc->mutex); - srand(getpid() + (unsigned) switch_timestamp(NULL)); + srand(getpid() + (unsigned) switch_epoch_time_now(NULL)); while (alloc->track_used < alloc->track_len) { uint32_t index; Modified: freeswitch/trunk/src/switch_core_session.c ============================================================================== --- freeswitch/trunk/src/switch_core_session.c (original) +++ freeswitch/trunk/src/switch_core_session.c Sun Jan 25 15:23:07 2009 @@ -874,7 +874,7 @@ switch_event_fire(&event); /* reschedule this task */ - task->runtime = switch_timestamp(NULL) + session->track_duration; + task->runtime = switch_epoch_time_now(NULL) + session->track_duration; switch_core_session_rwunlock(session); } @@ -892,7 +892,7 @@ { switch_core_session_unsched_heartbeat(session); - session->track_id = switch_scheduler_add_task(switch_timestamp(NULL), sch_heartbeat_callback, (char *) __SWITCH_FUNC__, + session->track_id = switch_scheduler_add_task(switch_epoch_time_now(NULL), sch_heartbeat_callback, (char *) __SWITCH_FUNC__, switch_core_session_get_uuid(session), 0, strdup(switch_core_session_get_uuid(session)), SSHF_FREE_ARG); } Modified: freeswitch/trunk/src/switch_core_sqldb.c ============================================================================== --- freeswitch/trunk/src/switch_core_sqldb.c (original) +++ freeswitch/trunk/src/switch_core_sqldb.c Sun Jan 25 15:23:07 2009 @@ -278,7 +278,7 @@ sql = switch_mprintf("insert into channels (uuid,created,created_epoch, name,state,dialplan,context) values('%q','%q','%ld','%q','%q','%q','%q')", switch_event_get_header_nil(event, "unique-id"), switch_event_get_header_nil(event, "event-date-local"), - (long)switch_timestamp(NULL), + (long)switch_epoch_time_now(NULL), switch_event_get_header_nil(event, "channel-name"), switch_event_get_header_nil(event, "channel-state"), switch_event_get_header_nil(event, "caller-dialplan"), @@ -339,7 +339,7 @@ case SWITCH_EVENT_CHANNEL_BRIDGE: sql = switch_mprintf("insert into calls values ('%s', '%ld', '%s','%q','%q','%q','%q','%s','%q','%q','%q','%q','%s')", switch_event_get_header_nil(event, "event-date-local"), - (long)switch_timestamp(NULL), + (long)switch_epoch_time_now(NULL), switch_event_get_header_nil(event, "event-calling-function"), switch_event_get_header_nil(event, "caller-caller-id-name"), switch_event_get_header_nil(event, "caller-caller-id-number"), Modified: freeswitch/trunk/src/switch_event.c ============================================================================== --- freeswitch/trunk/src/switch_event.c (original) +++ freeswitch/trunk/src/switch_event.c Sun Jan 25 15:23:07 2009 @@ -1019,7 +1019,7 @@ switch_time_exp_t tm; char date[80] = ""; switch_size_t retsize; - switch_time_t ts = switch_timestamp_now(); + switch_time_t ts = switch_micro_time_now(); switch_assert(BLOCK != NULL); switch_assert(RUNTIME_POOL != NULL); Modified: freeswitch/trunk/src/switch_ivr.c ============================================================================== --- freeswitch/trunk/src/switch_ivr.c (original) +++ freeswitch/trunk/src/switch_ivr.c Sun Jan 25 15:23:07 2009 @@ -42,7 +42,7 @@ { switch_channel_t *channel = switch_core_session_get_channel(session); switch_status_t status = SWITCH_STATUS_SUCCESS; - switch_time_t start = switch_timestamp_now(), now, done = switch_timestamp_now() + (ms * 1000); + switch_time_t start = switch_micro_time_now(), now, done = switch_micro_time_now() + (ms * 1000); switch_frame_t *read_frame, cng_frame = { 0 }; int32_t left, elapsed; char data[2] = ""; @@ -114,7 +114,7 @@ } for (;;) { - now = switch_timestamp_now(); + now = switch_micro_time_now(); elapsed = (int32_t) ((now - start) / 1000); left = ms - elapsed; @@ -452,9 +452,9 @@ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Command Execute %s(%s)\n", switch_channel_get_name(channel), app_name, switch_str_nil(app_arg)); - b4 = switch_timestamp_now(); + b4 = switch_micro_time_now(); switch_core_session_exec(session, application_interface, app_arg); - aftr = switch_timestamp_now(); + aftr = switch_micro_time_now(); if (!switch_channel_ready(channel) || switch_channel_test_flag(channel, CF_STOP_BROADCAST) || aftr - b4 < 500000) { break; } @@ -593,7 +593,7 @@ if ((timeout = atoi(to)) < 0) { timeout = 0; } else { - expires = switch_timestamp(NULL) + timeout; + expires = switch_epoch_time_now(NULL) + timeout; } } @@ -610,7 +610,7 @@ break; } - if (expires && switch_timestamp(NULL) >= expires) { + if (expires && switch_epoch_time_now(NULL) >= expires) { switch_channel_hangup(channel, SWITCH_CAUSE_RECOVERY_ON_TIMER_EXPIRE); break; } @@ -733,7 +733,7 @@ } if (timeout) { - started = switch_timestamp_now(); + started = switch_micro_time_now(); } while (switch_channel_ready(channel)) { @@ -748,7 +748,7 @@ } if (timeout) { - elapsed = (uint32_t) ((switch_timestamp_now() - started) / 1000); + elapsed = (uint32_t) ((switch_micro_time_now() - started) / 1000); if (elapsed >= timeout) { break; } @@ -855,7 +855,7 @@ } if (abs_timeout) { - started = switch_timestamp_now(); + started = switch_micro_time_now(); } if (digit_timeout && first_timeout) { @@ -868,14 +868,14 @@ if (eff_timeout) { - digit_started = switch_timestamp_now(); + digit_started = switch_micro_time_now(); } while (switch_channel_ready(channel)) { switch_frame_t *read_frame; if (abs_timeout) { - abs_elapsed = (uint32_t) ((switch_timestamp_now() - started) / 1000); + abs_elapsed = (uint32_t) ((switch_micro_time_now() - started) / 1000); if (abs_elapsed >= abs_timeout) { break; } @@ -887,7 +887,7 @@ if (eff_timeout) { - digit_elapsed = (uint32_t) ((switch_timestamp_now() - digit_started) / 1000); + digit_elapsed = (uint32_t) ((switch_micro_time_now() - digit_started) / 1000); if (digit_elapsed >= eff_timeout) { status = SWITCH_STATUS_TIMEOUT; break; @@ -900,7 +900,7 @@ if (eff_timeout) { eff_timeout = digit_timeout; - digit_started = switch_timestamp_now(); + digit_started = switch_micro_time_now(); } for (y = 0; y <= maxdigits; y++) { @@ -1476,12 +1476,12 @@ stream->digits = tmp; *(stream->digits + (len++)) = digit; *(stream->digits + len) = '\0'; - stream->last_digit_time = switch_timestamp_now() / 1000; + stream->last_digit_time = switch_micro_time_now() / 1000; } } } /* don't allow collected digit string testing if there are varying sized keys until timeout */ - if (parser->maxlen - parser->minlen > 0 && (switch_timestamp_now() / 1000) - stream->last_digit_time < parser->digit_timeout_ms) { + if (parser->maxlen - parser->minlen > 0 && (switch_micro_time_now() / 1000) - stream->last_digit_time < parser->digit_timeout_ms) { len = 0; } /* if we have digits to test */ Modified: freeswitch/trunk/src/switch_ivr_async.c ============================================================================== --- freeswitch/trunk/src/switch_ivr_async.c (original) +++ freeswitch/trunk/src/switch_ivr_async.c Sun Jan 25 15:23:07 2009 @@ -378,7 +378,7 @@ switch_channel_pre_answer(channel); if (limit) { - to = switch_timestamp(NULL) + limit; + to = switch_epoch_time_now(NULL) + limit; } if (flags && strchr(flags, 'm')) { @@ -892,7 +892,7 @@ } if (limit) { - to = switch_timestamp(NULL) + limit; + to = switch_epoch_time_now(NULL) + limit; } if ((status = switch_core_media_bug_add(session, record_callback, fh, to, flags, &bug)) != SWITCH_STATUS_SUCCESS) { @@ -1525,7 +1525,7 @@ { switch_channel_t *channel = switch_core_session_get_channel(session); dtmf_meta_data_t *md = switch_channel_get_private(channel, SWITCH_META_VAR_KEY); - time_t now = switch_timestamp(NULL); + time_t now = switch_epoch_time_now(NULL); char digit[2] = ""; int dval; Modified: freeswitch/trunk/src/switch_ivr_originate.c ============================================================================== --- freeswitch/trunk/src/switch_ivr_originate.c (original) +++ freeswitch/trunk/src/switch_ivr_originate.c Sun Jan 25 15:23:07 2009 @@ -219,7 +219,7 @@ time_t start) { int x = 0,i; - time_t elapsed = switch_timestamp(NULL) - start; + time_t elapsed = switch_epoch_time_now(NULL) - start; for (i = 0; i < max; i++) { if (originate_status[i].peer_channel && switch_channel_get_state(originate_status[i].peer_channel) < CS_HANGUP) { @@ -592,7 +592,7 @@ } timelimit *= 1000000; - start = switch_timestamp_now(); + start = switch_micro_time_now(); if (caller_channel) { if (switch_channel_test_flag(caller_channel, CF_ANSWERED)) { @@ -708,7 +708,7 @@ while (switch_channel_ready(peer_channel) && !(switch_channel_test_flag(peer_channel, CF_ANSWERED) || switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA))) { - int diff = (int) (switch_timestamp_now() - start); + int diff = (int) (switch_micro_time_now() - start); if (diff > timelimit) { status = SWITCH_STATUS_TIMEOUT; @@ -1486,7 +1486,7 @@ } } - switch_timestamp(&start); + switch_epoch_time_now(&start); for (;;) { uint32_t valid_channels = 0; @@ -1514,7 +1514,7 @@ goto notready; } - elapsed = switch_timestamp(NULL) - start; + elapsed = switch_epoch_time_now(NULL) - start; if (elapsed > (time_t) timelimit_sec) { to++; @@ -1653,7 +1653,7 @@ } while ((!caller_channel || switch_channel_ready(caller_channel)) && check_channel_status(&oglobals, originate_status, and_argc)) { - time_t elapsed = switch_timestamp(NULL) - start; + time_t elapsed = switch_epoch_time_now(NULL) - start; if (caller_channel && !oglobals.sent_ring && oglobals.ring_ready && !oglobals.return_ring_ready) { switch_channel_ring_ready(caller_channel); oglobals.sent_ring = 1; Modified: freeswitch/trunk/src/switch_ivr_play_say.c ============================================================================== --- freeswitch/trunk/src/switch_ivr_play_say.c (original) +++ freeswitch/trunk/src/switch_ivr_play_say.c Sun Jan 25 15:23:07 2009 @@ -497,7 +497,7 @@ } if (limit) { - start = switch_timestamp(NULL); + start = switch_epoch_time_now(NULL); } if (fh->thresh) { @@ -531,7 +531,7 @@ switch_ivr_parse_all_events(session); } - if (start && (switch_timestamp(NULL) - start) > limit) { + if (start && (switch_epoch_time_now(NULL) - start) > limit) { break; } Modified: freeswitch/trunk/src/switch_log.c ============================================================================== --- freeswitch/trunk/src/switch_log.c (original) +++ freeswitch/trunk/src/switch_log.c Sun Jan 25 15:23:07 2009 @@ -246,7 +246,7 @@ const char *filep = (file ? switch_cut_path(file) : ""); const char *funcp = (func ? func : ""); char *content = NULL; - switch_time_t now = switch_timestamp_now(); + switch_time_t now = switch_micro_time_now(); uint32_t len; const char *extra_fmt = "%s [%s] %s:%d %s()%c%s"; Modified: freeswitch/trunk/src/switch_resample.c ============================================================================== --- freeswitch/trunk/src/switch_resample.c (original) +++ freeswitch/trunk/src/switch_resample.c Sun Jan 25 15:23:07 2009 @@ -206,7 +206,7 @@ int16_t x; uint32_t i; int sum_rnd = 0; - int16_t rnd2 = (int16_t) switch_timestamp_now(); + int16_t rnd2 = (int16_t) switch_micro_time_now(); assert(divisor); Modified: freeswitch/trunk/src/switch_rtp.c ============================================================================== --- freeswitch/trunk/src/switch_rtp.c (original) +++ freeswitch/trunk/src/switch_rtp.c Sun Jan 25 15:23:07 2009 @@ -228,7 +228,7 @@ #if 0 if (rtp_session->last_stun) { - elapsed = (unsigned int) ((switch_timestamp_now() - rtp_session->last_stun) / 1000); + elapsed = (unsigned int) ((switch_micro_time_now() - rtp_session->last_stun) / 1000); if (elapsed > 30000) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No stun for a long time (PUNT!)\n"); @@ -282,7 +282,7 @@ } if (rtp_session->last_stun) { - elapsed = (unsigned int) ((switch_timestamp_now() - rtp_session->last_stun) / 1000); + elapsed = (unsigned int) ((switch_micro_time_now() - rtp_session->last_stun) / 1000); if (elapsed > 30000) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No stun for a long time (PUNT!)\n"); @@ -310,7 +310,7 @@ return; } - rtp_session->last_stun = switch_timestamp_now(); + rtp_session->last_stun = switch_micro_time_now(); } static void handle_ice(switch_rtp_t *rtp_session, void *data, switch_size_t len) @@ -346,7 +346,7 @@ } end_buf = buf + ((sizeof(buf) > packet->header.length) ? packet->header.length : sizeof(buf)); - rtp_session->last_stun = switch_timestamp_now(); + rtp_session->last_stun = switch_micro_time_now(); switch_stun_packet_first_attribute(packet, attr); @@ -830,7 +830,7 @@ rtp_session->seq = (uint16_t) rand(); - rtp_session->ssrc = (uint32_t) ((intptr_t) &rtp_session + (uint32_t) switch_timestamp(NULL)); + rtp_session->ssrc = (uint32_t) ((intptr_t) &rtp_session + (uint32_t) switch_epoch_time_now(NULL)); rtp_session->send_msg.header.ssrc = htonl(rtp_session->ssrc); rtp_session->send_msg.header.ts = 0; rtp_session->send_msg.header.m = 0; @@ -1967,7 +1967,7 @@ } if (!rtp_session->timer.interval && - ((unsigned)((switch_timestamp_now() - rtp_session->last_write_timestamp))) > (rtp_session->ms_per_packet *2)) { + ((unsigned)((switch_micro_time_now() - rtp_session->last_write_timestamp))) > (rtp_session->ms_per_packet *2)) { m++; } @@ -1995,7 +1995,7 @@ uint32_t rate = 0; uint32_t codec_flags = 0; uint32_t len = sizeof(decoded); - time_t now = switch_timestamp(NULL); + time_t now = switch_epoch_time_now(NULL); send = 0; if (rtp_session->vad_data.scan_freq && rtp_session->vad_data.next_scan <= now) { @@ -2132,7 +2132,7 @@ if (rtp_session->timer.interval) { rtp_session->last_write_samplecount = rtp_session->timer.samplecount; } else { - rtp_session->last_write_timestamp = (uint32_t) switch_timestamp_now(); + rtp_session->last_write_timestamp = (uint32_t) switch_micro_time_now(); } rtp_session->last_write_ts = this_ts; @@ -2209,7 +2209,7 @@ rtp_session->vad_data.cng_freq = 50; rtp_session->vad_data.ts = 1; rtp_session->vad_data.start = 0; - rtp_session->vad_data.next_scan = switch_timestamp(NULL); + rtp_session->vad_data.next_scan = switch_epoch_time_now(NULL); rtp_session->vad_data.scan_freq = 0; switch_set_flag_locked(rtp_session, SWITCH_RTP_FLAG_VAD); switch_set_flag(&rtp_session->vad_data, SWITCH_VAD_FLAG_CNG); Modified: freeswitch/trunk/src/switch_scheduler.c ============================================================================== --- freeswitch/trunk/src/switch_scheduler.c (original) +++ freeswitch/trunk/src/switch_scheduler.c Sun Jan 25 15:23:07 2009 @@ -107,7 +107,7 @@ if (done) { tp->destroyed = 1; } else { - int64_t now = switch_timestamp(NULL); + int64_t now = switch_epoch_time_now(NULL); if (now >= tp->task.runtime && !tp->in_thread) { int32_t diff = (int32_t) (now - tp->task.runtime); if (diff > 1) { @@ -190,7 +190,7 @@ switch_zmalloc(container, sizeof(*container)); switch_assert(func); container->func = func; - container->task.created = switch_timestamp(NULL); + container->task.created = switch_epoch_time_now(NULL); container->task.runtime = task_runtime; container->task.group = strdup(group ? group : "none"); container->task.cmd_id = cmd_id; Modified: freeswitch/trunk/src/switch_stun.c ============================================================================== --- freeswitch/trunk/src/switch_stun.c (original) +++ freeswitch/trunk/src/switch_stun.c Sun Jan 25 15:23:07 2009 @@ -105,7 +105,7 @@ max = (int) strlen(set); - srand((unsigned int) switch_timestamp_now()); + srand((unsigned int) switch_micro_time_now()); for (x = 0; x < len; x++) { int j = (int) (max * 1.0 * rand() / (RAND_MAX + 1.0)); @@ -510,7 +510,7 @@ } switch_socket_sendto(sock, remote_addr, 0, (void *) packet, &bytes); - started = switch_timestamp_now(); + started = switch_micro_time_now(); *ip = NULL; *port = 0; @@ -522,7 +522,7 @@ break; } - if ((elapsed = (unsigned int) ((switch_timestamp_now() - started) / 1000)) > 5000) { + if ((elapsed = (unsigned int) ((switch_micro_time_now() - started) / 1000)) > 5000) { *err = "Timeout"; switch_socket_shutdown(sock, SWITCH_SHUTDOWN_READWRITE); switch_socket_close(sock); Modified: freeswitch/trunk/src/switch_time.c ============================================================================== --- freeswitch/trunk/src/switch_time.c (original) +++ freeswitch/trunk/src/switch_time.c Sun Jan 25 15:23:07 2009 @@ -111,15 +111,15 @@ } -SWITCH_DECLARE(switch_time_t) switch_timestamp_now(void) +SWITCH_DECLARE(switch_time_t) switch_micro_time_now(void) { return runtime.timestamp ? runtime.timestamp : switch_time_now(); } -SWITCH_DECLARE(time_t) switch_timestamp(time_t *t) +SWITCH_DECLARE(time_t) switch_epoch_time_now(time_t *t) { - time_t now = switch_timestamp_now() / APR_USEC_PER_SEC; + time_t now = switch_micro_time_now() / APR_USEC_PER_SEC; if (t) { *t = now; } @@ -671,7 +671,7 @@ time_t timep; if (!thetime) { - thetime = switch_timestamp_now(); + thetime = switch_micro_time_now(); } timep = (thetime) / (int64_t) (1000000); @@ -707,7 +707,7 @@ switch_time_exp_t stm; if (!thetime) { - thetime = switch_timestamp_now(); + thetime = switch_micro_time_now(); } timep = (thetime) / (int64_t) (1000000); Modified: freeswitch/trunk/src/switch_utils.c ============================================================================== --- freeswitch/trunk/src/switch_utils.c (original) +++ freeswitch/trunk/src/switch_utils.c Sun Jan 25 15:23:07 2009 @@ -377,7 +377,7 @@ unsigned char in[B64BUFFLEN]; unsigned char out[B64BUFFLEN + 512]; - switch_snprintf(filename, 80, "%smail.%d%04x", SWITCH_GLOBAL_dirs.temp_dir, (int) switch_timestamp(NULL), rand() & 0xffff); + switch_snprintf(filename, 80, "%smail.%d%04x", SWITCH_GLOBAL_dirs.temp_dir, (int) switch_epoch_time_now(NULL), rand() & 0xffff); if ((fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644))) { if (file) { @@ -828,7 +828,7 @@ switch_time_t ret = 0; char *pattern = "^(\\d+)-(\\d+)-(\\d+)\\s*(\\d*):{0,1}(\\d*):{0,1}(\\d*)"; - switch_time_exp_lt(&tm, switch_timestamp_now()); + switch_time_exp_lt(&tm, switch_micro_time_now()); tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = 0; if ((proceed = switch_regex_perform(in, pattern, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
participants (1)
-
FreeSWITCH SVN