mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
rtsp: weekday and month names in RTSP date string should be in C locale
Create date string using C locale weekday and month names. Fixes #617636.
This commit is contained in:
parent
f99cb8b9bd
commit
7fee2c0fe7
1 changed files with 14 additions and 8 deletions
|
@ -1022,20 +1022,26 @@ add_auth_header (GstRTSPConnection * conn, GstRTSPMessage * message)
|
||||||
static void
|
static void
|
||||||
gen_date_string (gchar * date_string, guint len)
|
gen_date_string (gchar * date_string, guint len)
|
||||||
{
|
{
|
||||||
GTimeVal tv;
|
static const char wkdays[7][4] =
|
||||||
|
{ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
|
||||||
|
static const char months[12][4] =
|
||||||
|
{ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct",
|
||||||
|
"Nov", "Dec"
|
||||||
|
};
|
||||||
|
struct tm tm;
|
||||||
time_t t;
|
time_t t;
|
||||||
#ifdef HAVE_GMTIME_R
|
|
||||||
struct tm tm_;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
g_get_current_time (&tv);
|
time (&t);
|
||||||
t = (time_t) tv.tv_sec;
|
|
||||||
|
|
||||||
#ifdef HAVE_GMTIME_R
|
#ifdef HAVE_GMTIME_R
|
||||||
strftime (date_string, len, "%a, %d %b %Y %H:%M:%S GMT", gmtime_r (&t, &tm_));
|
gmtime_r (&t, &tm);
|
||||||
#else
|
#else
|
||||||
strftime (date_string, len, "%a, %d %b %Y %H:%M:%S GMT", gmtime (&t));
|
tm = *gmtime (&t);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
g_snprintf (date_string, len, "%s, %02d %s %04d %02d:%02d:%02d GMT",
|
||||||
|
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