[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[pdf-devel] Re: Calendar spans
From: |
jemarch |
Subject: |
[pdf-devel] Re: Calendar spans |
Date: |
Sun, 18 May 2008 18:19:28 +0200 |
User-agent: |
Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shijō) APEL/10.6 Emacs/23.0.60 (powerpc-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) |
> 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 <address@hidden>
<address@hidden>
GNU Spain http://es.gnu.org
GNU Project http://www.gnu.org
- [pdf-devel] Calendar spans, Aleksander Morgado, 2008/05/11
- [pdf-devel] Re: Calendar spans, jemarch, 2008/05/13
- [pdf-devel] Re: Calendar spans, Aleksander Morgado, 2008/05/17
- [pdf-devel] Re: Calendar spans, jemarch, 2008/05/18
- [pdf-devel] Re: Calendar spans, Aleksander Morgado, 2008/05/18
- [pdf-devel] Re: Calendar spans,
jemarch <=
- [pdf-devel] Re: Calendar spans, Aleksander Morgado, 2008/05/18
- Re: [pdf-devel] Re: Calendar spans, Stuart Jansen, 2008/05/18
- Re: [pdf-devel] Re: Calendar spans, jemarch, 2008/05/18
- Re: [pdf-devel] Re: Calendar spans, Aleksander Morgado, 2008/05/18
- Re: [pdf-devel] Re: Calendar spans, jemarch, 2008/05/18
- [pdf-devel] Re: Calendar spans, jemarch, 2008/05/18