bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: parse_time()


From: Bruno Haible
Subject: Re: parse_time()
Date: Sun, 2 Nov 2008 19:52:57 +0100
User-agent: KMail/1.5.4

Hi,

Bruce Korb wrote:
> I had need of a function to convert some variation of a time (duration)
> specification into a count of seconds.  For your amusement and optional
> inclusion...(I *think* I've got papers on file for gnulib....)
> 
> It accepts several formats:
> 
>    [DD d] [HH h] [MM m] [SS s]
>    [DD d] [[HH:]MM:]SS
>    [DD d] [HH h] [MM:]SS
> 
> though it is unhappy if it finds nothing.

Yes, I think if several programs can agree to parse durations in the same
way, this can only be beneficial.

Looking at wikipedia [1], I would find it good if
  1) the function was called 'parse_duration', not 'parse_time' (since "time"
     often denotes a time instant within a day),
  2) the three duration formats described in [1] were also supported.

Bruno

[1] http://en.wikipedia.org/wiki/ISO_8601#Durations





reply via email to

[Prev in Thread] Current Thread [Next in Thread]