mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-21 05:26:23 +00:00
flvmux: Use GDateTime instead of gmtime()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6872>
This commit is contained in:
parent
a6a1fd03cc
commit
441e71d1ff
1 changed files with 9 additions and 11 deletions
|
@ -1180,8 +1180,7 @@ gst_flv_mux_create_metadata (GstFlvMux * mux)
|
|||
tag_string = NULL;
|
||||
|
||||
{
|
||||
time_t secs;
|
||||
struct tm tm;
|
||||
GDateTime *now;
|
||||
gchar *s;
|
||||
static const gchar *weekdays[] = {
|
||||
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
|
||||
|
@ -1191,16 +1190,15 @@ gst_flv_mux_create_metadata (GstFlvMux * mux)
|
|||
"Aug", "Sep", "Oct", "Nov", "Dec"
|
||||
};
|
||||
|
||||
secs = g_get_real_time () / G_USEC_PER_SEC;
|
||||
#ifdef HAVE_GMTIME_R
|
||||
gmtime_r (&secs, &tm);
|
||||
#else
|
||||
tm = *gmtime (&secs);
|
||||
#endif
|
||||
now = g_date_time_new_now_utc ();
|
||||
|
||||
s = g_strdup_printf ("%s %s %d %02d:%02d:%02d %d", weekdays[tm.tm_wday],
|
||||
months[tm.tm_mon], tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec,
|
||||
tm.tm_year + 1900);
|
||||
s = g_strdup_printf ("%s %s %u %02u:%02u:%02u %u",
|
||||
weekdays[g_date_time_get_day_of_week (now)],
|
||||
months[g_date_time_get_month (now)], g_date_time_get_day_of_month (now),
|
||||
g_date_time_get_hour (now), g_date_time_get_minute (now),
|
||||
g_date_time_get_second (now), g_date_time_get_year (now));
|
||||
|
||||
g_date_time_unref (now);
|
||||
|
||||
_gst_buffer_new_and_alloc (2 + 12 + 1 + 2 + strlen (s), &tmp, &data);
|
||||
data[0] = 0; /* 12 bytes name */
|
||||
|
|
Loading…
Reference in a new issue