pdf-devel
[Top][All Lists]
Advanced

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

Re: [pdf-devel] Re: Calendar spans


From: jemarch
Subject: Re: [pdf-devel] Re: Calendar spans
Date: Sun, 18 May 2008 18:36:58 +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)

Hi.

   > Well... don't really like it. This means that there are three different 
   > time origins for which the calendar time span gives the same result... 
   > isn't it?
   > 
   > 29 January 2007 + (1 year + 1 month) = 29 February 2008
   > 30 January 2007 + (1 year + 1 month) = 29 February 2008
   > 31 January 2007 + (1 year + 1 month) = 29 February 2008

   Have you considered doing a survey of other Date/Time/Calendar
   implementations to find out how they solve this problem? For example, a
   lot of careful thought and research has gone into the Perl DateTime
   modules.

   
http://search.cpan.org/dist/DateTime/lib/DateTime.pm#Adding_a_Duration_to_a_Datetime

Very interesting. Thanks for the hint! :)

It seems that the perl modules uses the same approach I was
suggesting:

   "DateTime.pm always adds (or subtracts) days, then months, minutes,
   and then seconds and nanoseconds. If there are any boundary
   overflows, these are normalized at each step. For the days and
   months (the calendar) the local (not UTC) values are used. For
   minutes and seconds, the local values are used. This generally just
   works.

   This means that adding one month and one day to February 28, 2003
   will produce the date April 1, 2003, not March 29, 2003."

-- 
Jose E. Marchesi  <address@hidden>
                  <address@hidden>

GNU Spain         http://es.gnu.org
GNU Project       http://www.gnu.org




reply via email to

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