Commit ec3ac1ff authored by bcoudurier's avatar bcoudurier

use ctime1

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@13864 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent a0f34767
...@@ -304,6 +304,20 @@ static AVRandomState random_state; ...@@ -304,6 +304,20 @@ static AVRandomState random_state;
static FILE *logfile = NULL; 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 void __attribute__ ((format (printf, 1, 2))) http_log(const char *fmt, ...)
{ {
static int print_prefix = 1; static int print_prefix = 1;
...@@ -312,11 +326,9 @@ static void __attribute__ ((format (printf, 1, 2))) http_log(const char *fmt, .. ...@@ -312,11 +326,9 @@ static void __attribute__ ((format (printf, 1, 2))) http_log(const char *fmt, ..
if (logfile) { if (logfile) {
if (print_prefix) { if (print_prefix) {
time_t current = time(0); char buf[32];
char buffer[32]; ctime1(buf);
strncpy(buffer, ctime(&current), 31); fprintf(logfile, "%s ", buf);
buffer[strlen(buffer)-1] = 0; // remove '\n'
fprintf(logfile, "%s ", buffer);
} }
print_prefix = strstr(fmt, "\n") != NULL; print_prefix = strstr(fmt, "\n") != NULL;
vfprintf(logfile, fmt, ap); vfprintf(logfile, fmt, ap);
...@@ -325,20 +337,6 @@ static void __attribute__ ((format (printf, 1, 2))) http_log(const char *fmt, .. ...@@ -325,20 +337,6 @@ static void __attribute__ ((format (printf, 1, 2))) http_log(const char *fmt, ..
va_end(ap); 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) static void log_connection(HTTPContext *c)
{ {
char buf2[32]; char buf2[32];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment