> Maybe I dont understand the issue, but the calculation of the lenght
> of months is deterministic: you only need to determine if the year of
> the time object is a leap one.
>
> Or I missing something?
>
Yes, the number of days in a month can be easily computed. But which
would be the result of the following situation?
Hm, now I see the problem.
I think that a simple precedence rule could be used: first years are
added, then months, then days, ...
/* Setting epoch as January 31st 2007 */
pdf_time_from_string(my_time,
"2007-01-31T00:00:00+00:00",
PDF_TIME_FORMAT_ISO_8601);
/* Setting calendar span as +1 month +1 year */
cal_span.sign = 0; /* add */
cal_span.years = 1;
cal_span.months = 1;
cal_span.days = 0;
cal_span.hours = 0;
cal_span.minutes = 0;
cal_span.seconds = 0;
/* Add calendar span to time object */
pdf_time_add_cal_span(my_time, cal_span);
/* Now... which should be the resulting date in my_time?
* Hint: 2008 is also leap year :-) */
The problem is that the result cannot be February 31st. So which
would be the resulting epoch?
Using the precedence rule first we add 1 year to 2007-01-31 resulting
in 2008-01-31. Then we add 1 month (February in a leap year) resulting
in 2008-02-29.
What do you think?
--
Jose E. Marchesi <[EMAIL PROTECTED]>
<[EMAIL PROTECTED]>
GNU Spain http://es.gnu.org
GNU Project http://www.gnu.org