[Asterisk-cvs] asterisk sched.c,1.14.2.1,1.14.2.2

russell at lists.digium.com russell at lists.digium.com
Fri Apr 15 02:33:03 CDT 2005


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

Modified Files:
      Tag: v1-0
	sched.c 
Log Message:
create useful output for time left to expire (bug #4022)


Index: sched.c
===================================================================
RCS file: /usr/cvsroot/asterisk/sched.c,v
retrieving revision 1.14.2.1
retrieving revision 1.14.2.2
diff -u -d -r1.14.2.1 -r1.14.2.2
--- sched.c	15 Apr 2005 07:15:39 -0000	1.14.2.1
+++ sched.c	15 Apr 2005 07:24:34 -0000	1.14.2.2
@@ -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;
+}




More information about the svn-commits mailing list