Next Release

Stewart Gordon smjg_1998 at yahoo.com
Mon Apr 25 03:45:24 PDT 2011


On 22/04/2011 20:48, Jonathan M Davis wrote:
>>> Well, then I'd better make sure that I get my most recent updates to
>>> std.datetime in soon.
>>>
>>> - Jonathan M Davis
>>
>> Does your library take into account that there's no year 0?
>
> Actually, for ISO 8601, which the library follows, there _is_ a year 0.

And astronomers have used this year numbering scheme since the 17th century, apparently.

> Date,
> DateTime, and SysTime all have the function yearBC which will give you the
> year as you would normally expect (1 B.C. being immediately prior to 1 A.D.
> with no year 0). But the ISO standard calls for a year 0, and I followed the
> standard (it's also way easier to deal with programmatically). So, other than
> the yearBC function, it treats 0 as the year prior to 1 A.D., and the years
> prior to 0 are negative.

I think most calendar APIs would use 0, -1, -2, etc. to denote 1BC, 2BC, 3BC, etc. because 
it's by far the easiest thing for both library and library user to work with.  And leave 
to formatting features the task of turning them into BC/AD forms.  Look at how my library
http://pr.stewartsplace.org.uk/d/sutil/
deals with it.  (OK, so it only really manipulates dates in its own linear numbering 
scheme, but you get the idea.)

Stewart.


More information about the Digitalmars-d-learn mailing list