Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv11347

Modified Files:
        sched.c 
Log Message:
Add sched_when function (bug #4022)


Index: sched.c
===================================================================
RCS file: /usr/cvsroot/asterisk/sched.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- sched.c     20 Jul 2004 13:43:33 -0000      1.14
+++ sched.c     13 Apr 2005 18:46:35 -0000      1.15
@@ -399,3 +399,28 @@
        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;
+}

_______________________________________________
Asterisk-Cvs mailing list
[email protected]
http://lists.digium.com/mailman/listinfo/asterisk-cvs

Reply via email to