static void LogText(void *opaque, int type, const vlc_log_t *meta,
const char *format, va_list ap)
struct timespec ts;
struct tm curtime;
char tmBuf[128];
timespec_get(&ts, TIME_UTC);
if (localtime_r(&ts.tv_sec, &curtime) == NULL) {
gmtime_r(&ts.tv_sec, &curtime);
}
if (strftime(tmBuf, sizeof(tmBuf), "%M%S", &curtime) == 0) {
strcpy(tmBuf, "no time");
}
fprintf(stream, "%s.%03d %s%s: ", tmBuf, (int)(ts.tv_nsec / 1000000), meta->psz_module, msg_type[type]);
沒有留言:
張貼留言