[Freeswitch-trunk] [commit] r12741 - in freeswitch/trunk/libs/sofia-sip: . s2check

FreeSWITCH SVN mikej at freeswitch.org
Tue Mar 24 08:40:31 PDT 2009


Author: mikej
Date: Tue Mar 24 10:40:31 2009
New Revision: 12741

Log:
Thu Mar  5 13:20:53 CST 2009  Pekka Pessi <first.last at nokia.com>
  * s2util.h, s2time.c: added s2_timed_logger()
  Ignore-this: 504e7e5c1201b0b2d5c345c31d5d4b71


Modified:
   freeswitch/trunk/libs/sofia-sip/.update
   freeswitch/trunk/libs/sofia-sip/s2check/s2time.c
   freeswitch/trunk/libs/sofia-sip/s2check/s2util.h

Modified: freeswitch/trunk/libs/sofia-sip/.update
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/.update	(original)
+++ freeswitch/trunk/libs/sofia-sip/.update	Tue Mar 24 10:40:31 2009
@@ -1 +1 @@
-Tue Mar 24 10:38:12 CDT 2009
+Tue Mar 24 10:39:35 CDT 2009

Modified: freeswitch/trunk/libs/sofia-sip/s2check/s2time.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/s2check/s2time.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/s2check/s2time.c	Tue Mar 24 10:40:31 2009
@@ -26,6 +26,9 @@
 
 #include "s2util.h"
 
+#include <string.h>
+#include <stdio.h>
+
 /* -- Delay scenarios --------------------------------------------------- */
 
 static unsigned long time_offset;
@@ -49,3 +52,23 @@
     su_root_step(root, 0);
 }
 
+void
+s2_timed_logger(void *stream, char const *fmt, va_list ap)
+{
+  char buffer[4096];
+  su_time_t now = su_now();
+  size_t prefix, wrote;
+  int n;
+
+  snprintf(buffer, sizeof buffer,
+	   "%02u:%02u:%02u.%06lu[+%lu] ",
+	   (unsigned)(now.tv_sec / 3600 % 24),
+	   (unsigned)(now.tv_sec / 60 % 60),
+	   (unsigned)(now.tv_sec % 60),
+	   now.tv_usec,
+	   time_offset);
+  prefix = strlen(buffer);
+  n = vsnprintf(buffer + prefix, (sizeof buffer) - prefix, fmt, ap);
+  if (n > 0)
+    wrote = fwrite(buffer, prefix + n, 1, stream);
+}

Modified: freeswitch/trunk/libs/sofia-sip/s2check/s2util.h
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/s2check/s2util.h	(original)
+++ freeswitch/trunk/libs/sofia-sip/s2check/s2util.h	Tue Mar 24 10:40:31 2009
@@ -34,10 +34,12 @@
  */
 
 #include <sofia-sip/su_wait.h>
+#include <stdarg.h>
 
 SOFIA_BEGIN_DECLS
 
 void s2_fast_forward(unsigned long seconds, su_root_t *root);
+void s2_timed_logger(void *stream, char const *fmt, va_list ap);
 
 SOFIA_END_DECLS
 



More information about the Freeswitch-trunk mailing list