MODAPP-165 time_test error checking
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10361 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
90f1f37222
commit
2fbe2fd1cf
|
@ -46,11 +46,16 @@ SWITCH_STANDARD_API(time_test_function)
|
||||||
{
|
{
|
||||||
switch_time_t now, then;
|
switch_time_t now, then;
|
||||||
int x;
|
int x;
|
||||||
long mss = atol(cmd);
|
long mss;
|
||||||
uint32_t total = 0;
|
uint32_t total = 0;
|
||||||
int diff;
|
int diff;
|
||||||
int max = 10;
|
int max = 10;
|
||||||
char *p;
|
char *p;
|
||||||
|
if (switch_strlen_zero(cmd)){
|
||||||
|
stream->write_function(stream, "parameter missing\n");
|
||||||
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
mss = atol(cmd);
|
||||||
|
|
||||||
if ((p = strchr(cmd, ' '))) {
|
if ((p = strchr(cmd, ' '))) {
|
||||||
max = atoi(p+1);
|
max = atoi(p+1);
|
||||||
|
@ -63,7 +68,7 @@ SWITCH_STANDARD_API(time_test_function)
|
||||||
then = switch_time_now();
|
then = switch_time_now();
|
||||||
switch_yield(mss);
|
switch_yield(mss);
|
||||||
now = switch_time_now();
|
now = switch_time_now();
|
||||||
diff = (int) now - then;
|
diff = (int) (now - then);
|
||||||
stream->write_function(stream, "test %d sleep %ld %d\n", x+1, mss, diff);
|
stream->write_function(stream, "test %d sleep %ld %d\n", x+1, mss, diff);
|
||||||
total += diff;
|
total += diff;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue