pdf-devel
[Top][All Lists]
Advanced

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

[pdf-devel] Re: Calendar spans


From: Aleksander Morgado
Subject: [pdf-devel] Re: Calendar spans
Date: Sun, 18 May 2008 15:05:12 +0200
User-agent: Thunderbird 2.0.0.14 (Macintosh/20080421)


   > The base date to resolve the span should be the specified point of
   > time contained in OBJECT (would be better to name it TIME_OBJECT). In
   > other case the function doesnt have sense at all! This should be
   > documented in the Refman. entry for the function.

But even if the time origin is fixed, I see a problem: not all the months have the same number of days ( who the hell decided this? ). So if for example the time object represents January 31st and I want to add 1 month coming in the calendar span... which would be the resulting date? February 28th/29th? March 1st? The same problem happens with years if the time object is 29th February and you want to add 1 year in the calendar span... which would be the resulting date?

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?



pdf_time_t my_time;
struct pdf_time_cal_span_s cal_span;


/* 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?






reply via email to

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