[FFmpeg-devel] [PATCH] Enhace documentation for libavformat/utils.c:parse_date

Stefano Sabatini stefano.sabatini-lala
Wed Sep 12 12:32:12 CEST 2007

On date Wednesday 2007-09-12 12:00:50 +0200, Michael Niedermayer encoded:
> Hi
> On Wed, Sep 12, 2007 at 11:13:24AM +0200, Stefano Sabatini wrote:
> [...]
> > + * Returns the number of microseconds since 1st of January, 1970 up
> > + * to the time of the parsed date or up to the current time if \p
> > + * datestr cannot be successfully parsed.
> i do not think that this is the intended behavior but rather a "bug"
> in the implementation thus you change the API by hardcoding the bug in
> it and would need to bump the respective versions but i wont accept that

Got the point.
> using the current date in case a string cannot be parsed is a very odd
> way to handle an error

Completely agree. 

Possible solutions:

1. make parse_date return a negative number in case of error (what
happens if the date parsed is before 1970-01-01?)

2. deprecate parse_date in favour of libsomewhere/avsomething.h:av_parse_date
defined for example as:

int av_parse_date(int64_t *us_ptr, const char *datestr, int duration);

which returns an error code and puts in us_ptr the result in
microseconds of the parsing if datestr is parsable.

In this case is it OK to define it in libavutil?

Stefano Sabatini
Linux user number 337176 (see http://counter.li.org)

More information about the ffmpeg-devel mailing list