From c206cd797859d34fc2ff5340e8eca6cc70b11738 Mon Sep 17 00:00:00 2001 From: Sergey Dryabzhinsky Date: Thu, 24 Dec 2015 12:33:30 +0300 Subject: [PATCH] Use internal nginx functions, fix time format --- ngx_rtmp_send.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/ngx_rtmp_send.c b/ngx_rtmp_send.c index 295f131..7911f1b 100644 --- a/ngx_rtmp_send.c +++ b/ngx_rtmp_send.c @@ -3,8 +3,6 @@ * Copyright (C) Roman Arutyunyan */ -#include - #include #include #include "ngx_rtmp.h" @@ -876,10 +874,9 @@ ngx_rtmp_create_fi(ngx_rtmp_session_t *s) struct tm tm; struct timeval tv; - struct timezone tz; int errfl; - static u_char buf_time[NGX_TIME_T_LEN + 1]; + static u_char buf_time[NGX_TIME_T_LEN*2 + 1]; static u_char buf_date[NGX_TIME_T_LEN + 1]; @@ -916,7 +913,7 @@ ngx_rtmp_create_fi(ngx_rtmp_session_t *s) trans = 0; - errfl = gettimeofday(&tv, &tz); + errfl = ngx_gettimeofday(&tv); if (errfl) { ngx_log_error(NGX_LOG_DEBUG, s->connection->log, 0, @@ -929,7 +926,7 @@ ngx_rtmp_create_fi(ngx_rtmp_session_t *s) ngx_memzero(buf_time, sizeof(buf_time)); ngx_memzero(buf_date, sizeof(buf_date)); - errfl = sprintf((char *)buf_time, "%02d:%02d:%02d.%d", tm.tm_hour, tm.tm_min, tm.tm_sec, (int)tv.tv_usec); + errfl = sprintf((char *)buf_time, "%02d:%02d:%02d.%06d", tm.tm_hour, tm.tm_min, tm.tm_sec, (int)tv.tv_usec); // Strange order, but FMLE send like this errfl = sprintf((char *)buf_date, "%02d-%02d-%04d", tm.tm_mday, tm.tm_mon + 1, tm.tm_year + 1900);