Codebase list gupnp-av / 7456f97
New upstream version 0.14.1 Jeremy Bicha 1 year, 10 months ago
6 changed file(s) with 70 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
0 build-aux
1 *~
2 gupnp-av-marshal*
3 *.swp
4
5 /tests/test-search-criteria-parser
6 /vala/gupnp-av-1.0.stamp
7 /vala/gupnp-av-1.0.vapi
8 build
9 meson.build.user
10
0 0.14.1 (stable)
1 ===============
2 - Add utility function to format GDateTime to the iso variant
3 DIDL expects
4
5 All contributors to this release:
6 - Jens Georg <mail@jensge.org>
7
08 0.14.0 (stable)
19 ======
210
26442644
26452645 return ret;
26462646 }
2647
2648 /**
2649 * gupnp_format_date_time_for_didl_lite:
2650 * @date_time: DateTime to format
2651 *
2652 * Get the representation of DateTime as an ISO8601 string.
2653 *
2654 * DLNA requires a specific subset of ISO8601
2655 * Returns: (transfer full): @date_time formatted as an ISO8601 string
2656 */
2657 char *
2658 gupnp_format_date_time_for_didl_lite (GDateTime *date_time, gboolean date_only)
2659 {
2660 g_return_val_if_fail (date_time != NULL, NULL);
2661
2662 if (date_only) {
2663 return g_date_time_format (date_time, "%F");
2664 }
2665
2666 const char *format = "%FT%H:%M:%S";
2667 char *base_string = g_date_time_format (date_time, format);
2668 GString *iso_string = g_string_new (base_string);
2669
2670 // Check if we have sub-second precision. If so, we use that as well,
2671 // but cannot use %f since that will use microsecond precision, but DLNA
2672 // only allows for millisecond so we append the milliseconds manually
2673 if (g_date_time_get_microsecond (date_time) % G_TIME_SPAN_SECOND != 0) {
2674 g_string_append_printf (
2675 iso_string,
2676 ".%03d",
2677 g_date_time_get_microsecond (date_time) / 1000);
2678 }
2679
2680 GTimeSpan utc_offset = g_date_time_get_utc_offset (date_time);
2681 if (utc_offset == 0) {
2682 g_string_append (iso_string, "Z");
2683 } else {
2684 char *time_zone = g_date_time_format (date_time, "%:z");
2685 g_string_append (iso_string, time_zone);
2686 g_free (time_zone);
2687 }
2688
2689 g_free (base_string);
2690
2691 return g_string_free (iso_string, FALSE);
2692 }
276276 char *
277277 gupnp_didl_lite_object_get_xml_string (GUPnPDIDLLiteObject *object);
278278
279 char *
280 gupnp_format_date_time_for_didl_lite (GDateTime *date_time, gboolean date_only);
281
279282 G_END_DECLS
280283
281284 #endif /* __GUPNP_DIDL_LITE_OBJECT_H__ */
0 project('gupnp-av', 'c', version : '0.14.0', default_options: ['c_std=c11'])
0 project('gupnp-av', 'c', version : '0.14.1', default_options: ['c_std=c11'])
11
22 gnome = import('gnome')
33
1111 .expression skip
1212 ProtocolError skip
1313 protocol_error_quark skip
14 format_date_time_for_didl_lite.date_only default=false