aboutsummaryrefslogtreecommitdiffstats
path: root/sched.c
diff options
context:
space:
mode:
author(no author) <(no author)@f38db490-d61c-443f-a65b-d21fe96a405b>2005-11-21 16:53:51 +0000
committer(no author) <(no author)@f38db490-d61c-443f-a65b-d21fe96a405b>2005-11-21 16:53:51 +0000
commit0721731e93eb315ab19418b95fad8690417b8994 (patch)
tree84965a610f6ae7e51cd499f8bd89464f247db803 /sched.c
parent27a9c96742202c8188b53a0173649de479256b69 (diff)
This commit was manufactured by cvs2svn to create tag 'v1-0-10'.
git-svn-id: http://svn.digium.com/svn/asterisk/tags/v1-0-10@7178 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'sched.c')
-rwxr-xr-xsched.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/sched.c b/sched.c
index 786a26be6..e8c2238d8 100755
--- a/sched.c
+++ b/sched.c
@@ -287,7 +287,7 @@ int ast_sched_del(struct sched_context *con, int id)
}
ast_mutex_unlock(&con->lock);
if (!s) {
- ast_log(LOG_NOTICE, "Attempted to delete non-existant schedule entry %d!\n", id);
+ ast_log(LOG_NOTICE, "Attempted to delete nonexistent schedule entry %d!\n", id);
#ifdef DO_CRASH
CRASH;
#endif
@@ -399,3 +399,28 @@ int ast_sched_runq(struct sched_context *con)
ast_mutex_unlock(&con->lock);
return x;
}
+
+long ast_sched_when(struct sched_context *con,int id)
+{
+ struct sched *s;
+ long secs;
+ struct timeval now;
+ DEBUG(ast_log(LOG_DEBUG, "ast_sched_when()\n"));
+
+ ast_mutex_lock(&con->lock);
+ s=con->schedq;
+ while (s!=NULL) {
+ if (s->id==id) break;
+ s=s->next;
+ }
+ secs=-1;
+ if (s!=NULL) {
+ if (gettimeofday(&now, NULL)) {
+ ast_log(LOG_NOTICE, "gettimeofday() failed!\n");
+ } else {
+ secs=s->when.tv_sec-now.tv_sec;
+ }
+ }
+ ast_mutex_unlock(&con->lock);
+ return secs;
+}