change low res sleep func api names

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11486 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale committed 2009-01-25 21:23:07 +00:00
1 parent 1973ee74bc
commit 0463541d61
49 files changed
+180 -180

No files matched your search

@@ -1384,13 +1384,13 @@ SWITCH_STANDARD_API(tone_detect_session_function)
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 @@ SWITCH_STANDARD_API(sched_transfer_function)
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_STANDARD_API(sched_hangup_function)
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 @@ SWITCH_STANDARD_API(sched_broadcast_function)
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 @@ static void sch_api_callback(switch_scheduler_task_t *task)
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 @@ SWITCH_STANDARD_API(sched_api_function)
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);
}
@@ -473,7 +473,7 @@ SWITCH_STANDARD_APP(sched_transfer_function)
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_STANDARD_APP(sched_hangup_function)
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_STANDARD_APP(sched_broadcast_function)
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_STANDARD_APP(strftime_function)
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_STANDARD_API(strepoch_api_function)
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 @@ SWITCH_STANDARD_API(strftime_api_function)
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 @@ SWITCH_STANDARD_APP(tone_detect_session_function)
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");
}
+1 -1
View File
@@ -531,7 +531,7 @@ static switch_status_t enum_lookup(char *root, char *in, enum_record_t **results
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);
}
+2 -2
View File
@@ -205,7 +205,7 @@ SWITCH_STANDARD_APP(bcast_function)
}
}
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 @@ SWITCH_STANDARD_APP(bcast_function)
}
}
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);
+19 -19
View File
@@ -195,7 +195,7 @@ static switch_status_t caller_read_frame_callback(switch_core_session_t *session
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 @@ static switch_status_t caller_read_frame_callback(switch_core_session_t *session
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 @@ static switch_status_t hanguphook(switch_core_session_t *session)
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 @@ static void *SWITCH_THREAD_FUNC o_thread_run(switch_thread_t *thread, void *obj)
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 @@ static void find_consumers(fifo_node_t *node)
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_STANDARD_APP(fifo_function)
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 @@ SWITCH_STANDARD_APP(fifo_function)
to = 60;
}
}
cd.orbit_timeout = switch_timestamp(NULL) + to;
cd.orbit_timeout = switch_epoch_time_now(NULL) + to;
}
}
@@ -823,7 +823,7 @@ SWITCH_STANDARD_APP(fifo_function)
}
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_STANDARD_APP(fifo_function)
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 @@ SWITCH_STANDARD_APP(fifo_function)
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_STANDARD_APP(fifo_function)
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_STANDARD_APP(fifo_function)
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_STANDARD_APP(fifo_function)
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 @@ SWITCH_STANDARD_APP(fifo_function)
}
}
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 @@ SWITCH_STANDARD_APP(fifo_function)
}
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 @@ SWITCH_STANDARD_APP(fifo_function)
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 @@ SWITCH_STANDARD_APP(fifo_function)
}
} 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 @@ SWITCH_STANDARD_API(fifo_member_api_function)
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;
+1 -1
View File
@@ -140,7 +140,7 @@ SWITCH_STANDARD_APP(record_fsv_function)
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);
+1 -1
View File
@@ -811,7 +811,7 @@ SWITCH_STANDARD_APP(limit_hash_function)
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;
+1 -1
View File
@@ -478,7 +478,7 @@ SWITCH_STANDARD_APP(rss_function)
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);
@@ -1767,7 +1767,7 @@ static void voicemail_check_main(switch_core_session_t *session, const char *pro
}
}
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 @@ static switch_status_t deliver_vm(vm_profile_t *profile,
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 @@ static switch_status_t deliver_vm(vm_profile_t *profile,
&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 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, cons
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 @@ static void do_play(vm_profile_t *profile, char *user, char *domain, char *file,
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);