mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
rtspconnection: Use GDateTime instead of gmtime()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6872>
This commit is contained in:
parent
400c379c3d
commit
a6a1fd03cc
1 changed files with 8 additions and 12 deletions
|
@ -58,7 +58,6 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
/* we include this here to get the G_OS_* defines */
|
/* we include this here to get the G_OS_* defines */
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
@ -1431,20 +1430,17 @@ gen_date_string (gchar * date_string, guint len)
|
||||||
{ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct",
|
{ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct",
|
||||||
"Nov", "Dec"
|
"Nov", "Dec"
|
||||||
};
|
};
|
||||||
struct tm tm;
|
GDateTime *now;
|
||||||
time_t t;
|
|
||||||
|
|
||||||
time (&t);
|
now = g_date_time_new_now_utc ();
|
||||||
|
|
||||||
#ifdef HAVE_GMTIME_R
|
g_snprintf (date_string, len, "%s, %02u %s %04u %02u:%02u:%02u GMT",
|
||||||
gmtime_r (&t, &tm);
|
wkdays[g_date_time_get_day_of_week (now)],
|
||||||
#else
|
g_date_time_get_day_of_month (now), months[g_date_time_get_month (now)],
|
||||||
tm = *gmtime (&t);
|
g_date_time_get_year (now), g_date_time_get_hour (now),
|
||||||
#endif
|
g_date_time_get_minute (now), g_date_time_get_second (now));
|
||||||
|
|
||||||
g_snprintf (date_string, len, "%s, %02d %s %04d %02d:%02d:%02d GMT",
|
g_date_time_unref (now);
|
||||||
wkdays[tm.tm_wday], tm.tm_mday, months[tm.tm_mon], tm.tm_year + 1900,
|
|
||||||
tm.tm_hour, tm.tm_min, tm.tm_sec);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstRTSPResult
|
static GstRTSPResult
|
||||||
|
|
Loading…
Reference in a new issue