[Bug 677757] datetime: allow GstDateTime where not all fields are set

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Sun Jun 10 09:21:57 PDT 2012


https://bugzilla.gnome.org/show_bug.cgi?id=677757
  GStreamer | gstreamer (core) | git

--- Comment #4 from Tim-Philipp Müller <t.i.m at zen.co.uk> 2012-06-10 16:21:51 UTC ---
Thanks for working on this!

Couple of comments:

  - I don't think I'm a fan of exposing this API
    via flags, for two reasons: it's cumbersome
    to use both for date time creators and
    consumers (esp. the new + set_partial_flag
    thing is not very nice IMHO); and it kind of
    allows options that don't really make sense
    (everything valid but the month, for example).
    We can still use the flags, but keep them
    inside the .c file.

  - the flags are also not exposed properly for
     bindings, but that's a moot point because of
     the above (should be an enum, see for
     example GstObjectFlags)

  - I think creation should take place with one
    function call. This might mean we need to add
    _new_y(), _new_ym(), _new_ymd(), and
    _new_ymdt() (perhaps better named, dunno).
    Alternatively allow passing of 0 month/day/
    time/offset to _new_ymd()/_new_date()
    and _new(). Or both.

  - I think it would be enough to just differentiate
    between "have time" and "no time" for now. I'm
    not sure we really need to accommodate
    e.g. "hour only".

  - could add _new_from_iso8601_string() and
    _to_iso8601_string() utility functions (would
    be enough to handle YYYY, YYYY-MM,
    YYYY-MM-DD and YYYY-MMTHH:MM[:SS]Z
    and YYYY-MMTHH:MM[:SS]+/-XXXX or so
    for now IMHO (separate commit for this;
    should start with the most common variants,
    can add others later).

  - as for how to let a GstDateTime "consumer"
    query what fields are valid, I'm undecided:
    either _has_year(), _has_month(), has_day(),
    has_time() functions, or some kind of
    get_valid_fields() which returns an enum like
    GST_DATE_TIME_VALID_FIELDS_YEAR,
    GST_DATE_TIME_VALID_FIELDS_YEAR_MONTH,
    or _YYYY and _YYYY_MM etc., but that's not
    really much nicer either. I think I prefer _has_foo().
    Will ask for more opinions tomorrow.

-- 
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list