summaryrefslogtreecommitdiffstats
path: root/ffserver.c
diff options
context:
space:
mode:
authorBaptiste Coudurier <baptiste.coudurier@gmail.com>2008-06-22 01:12:39 +0000
committerBaptiste Coudurier <baptiste.coudurier@gmail.com>2008-06-22 01:12:39 +0000
commit9fd3442f632e7144249305ebcc120d245d03a916 (patch)
treec43a39ef3437d7ce78e07c4ea5ebd89cf0fa727b /ffserver.c
parent124ed1c07307c28815850d0dc666d12547afc015 (diff)
downloadffmpeg-streaming-9fd3442f632e7144249305ebcc120d245d03a916.zip
ffmpeg-streaming-9fd3442f632e7144249305ebcc120d245d03a916.tar.gz
use ctime1
Originally committed as revision 13864 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'ffserver.c')
-rw-r--r--ffserver.c36
1 files changed, 17 insertions, 19 deletions
diff --git a/ffserver.c b/ffserver.c
index 76f0f8a..0ed20e4 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -304,6 +304,20 @@ static AVRandomState random_state;
static FILE *logfile = NULL;
+static char *ctime1(char *buf2)
+{
+ time_t ti;
+ char *p;
+
+ ti = time(NULL);
+ p = ctime(&ti);
+ strcpy(buf2, p);
+ p = buf2 + strlen(p) - 1;
+ if (*p == '\n')
+ *p = '\0';
+ return buf2;
+}
+
static void __attribute__ ((format (printf, 1, 2))) http_log(const char *fmt, ...)
{
static int print_prefix = 1;
@@ -312,11 +326,9 @@ static void __attribute__ ((format (printf, 1, 2))) http_log(const char *fmt, ..
if (logfile) {
if (print_prefix) {
- time_t current = time(0);
- char buffer[32];
- strncpy(buffer, ctime(&current), 31);
- buffer[strlen(buffer)-1] = 0; // remove '\n'
- fprintf(logfile, "%s ", buffer);
+ char buf[32];
+ ctime1(buf);
+ fprintf(logfile, "%s ", buf);
}
print_prefix = strstr(fmt, "\n") != NULL;
vfprintf(logfile, fmt, ap);
@@ -325,20 +337,6 @@ static void __attribute__ ((format (printf, 1, 2))) http_log(const char *fmt, ..
va_end(ap);
}
-static char *ctime1(char *buf2)
-{
- time_t ti;
- char *p;
-
- ti = time(NULL);
- p = ctime(&ti);
- strcpy(buf2, p);
- p = buf2 + strlen(p) - 1;
- if (*p == '\n')
- *p = '\0';
- return buf2;
-}
-
static void log_connection(HTTPContext *c)
{
char buf2[32];
OpenPOWER on IntegriCloud