bug-gnulib
[Top][All Lists]
Advanced

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

Re: parse_duration()


From: Bruce Korb
Subject: Re: parse_duration()
Date: Sun, 02 Nov 2008 14:16:01 -0800
User-agent: Thunderbird 2.0.0.12 (X11/20071114)

Bruno Haible wrote:
The little question remaining though is "how many seconds in a year"
and, more importantly, "how many seconds in a month"?  In other words,
if some one in February were expecting P1M to represent a 28 day duration
and a 31 day duration had it been March, um, well,

Very good point. Maybe this means the functionality is better broken down
into a parsing stage and a conversion stage which ultimately produces seconds.
The state between these two would be a struct { year, months, weeks, days, ... 
}.
Hmm?

I think that there lies madness.  Is the duration that someone is trying to
express necessarily starting from now?  The primary intent was  for stuff like:

   timeout --duration='xxxxxxxx' some-command

which is, indeed, meaning "from now".  So, if this were to somehow become
widely used, it would be clearly incorrect to specify that some activity
was to happen a certain duration after an event of some sort, and have
"month" mean something different depending upon when that event happened
to happen.  That then raises the question of, "Why is anyone worrying over
durations that so far exceed a day that using months is important?"

For this context, the right, proper and easiest solution is to say that
months are 30 days and leave it at that.  Excruciating care just brings
up issues that are simply not worth the bother to figure out.

I did omit weeks in the last post.  So, posting again -- this time for sure.... 
:)

Cheers - Bruce




reply via email to

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