Skip to content

src: allow for year = 0; BC --> BCE; facilitate Astronomical and (B)CE timeline#1580

Open
evgaster wants to merge 16 commits intoc3d:stablefrom
evgaster:issue-1538
Open

src: allow for year = 0; BC --> BCE; facilitate Astronomical and (B)CE timeline#1580
evgaster wants to merge 16 commits intoc3d:stablefrom
evgaster:issue-1538

Conversation

@evgaster
Copy link

@evgaster evgaster commented Nov 28, 2025

A previous fix for issue 1538 incorrectly rules out year = 0; Removed that restriction.
Changed the BC indication to the preferred BCE.
Facilitate both the Astronomical and the (B)CE timeline.
Make the label for the DateMenu consistent.
Improve Date and Time documentation.
Replaced the code that converts between Julian en Gregorian dates by
functions from the Standards Of Fundamental Astronomy (SOFA) Libraries.

Signed-off-by: Ed@vanGasteren.net

A previous fix for issue 1538 incorrectly rules out year = 0;
Removed that restriction.

Signed-off-by: Ed@vanGasteren.net
BCE is a secular, non-religious alternative to BC, and both systems use the same year numbers, simply with different terminology. BCE is considered more inclusive as it does not reference Christianity.

Signed-off-by: Ed@vanGasteren.net
@evgaster evgaster changed the title src: allow for year = 0 src: allow for year = 0; BC --> BCE Nov 28, 2025
The BCE - CE timeline doesn't have a year = 0.
So years <= 0 are shifted. That wasn't handled properly.

Introduced setting AstronomicalYearNumbering (default) vs BCECEyearNumbering.

With AstronomicalYearNumbering the timeline is a uniform number line.
Years < 0 are presented, on the stack, with there sign.

With BCECEyearNumbering years <= 0 are presented shifted,
whithout a sign and with a BCE indicator.
Years > 0 get a CE indicator.

See: https://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar
and https://en.wikipedia.org/wiki/Astronomical_year_numbering

Signed-off-by: Ed@vanGasteren.net
@evgaster evgaster changed the title src: allow for year = 0; BC --> BCE src: allow for year = 0; BC --> BCE; facilitate Astronomical and (B)CE timeline Nov 29, 2025
There where inconsistent labels for the DateMenu.
Corrected those.

Signed-off-by: Ed@vanGasteren.net
A step towards a more complete documentation of the Date and Time
related command and settings.

Signed-off-by: Ed@vanGasteren.net
Signed-off-by: evgaster <Ed@vanGasteren.net>
Signed-off-by: evgaster <Ed@vanGasteren.net>
Signed-off-by: evgaster <Ed@vanGasteren.net>
Signed-off-by: evgaster <Ed@vanGasteren.net>
Fixed internal links.
Further explain handling of negative date.

Signed-off-by: Ed@vanGasteren.net
Replaced the code that converts between Julian en Gregorian dates by
functions from the Standards Of Fundamental Astronomy (SOFA) Libraries.
See: https://www.iausofa.org/.

Note: Because a Julian date starts at noon,
the timeline is shifted by half a day or 12 hours
with respect to the Gregorian timeline.

Further minor code convention changes and documentation updates.

Signed-off-by: Ed@vanGasteren.net
@c3d
Copy link
Owner

c3d commented Dec 19, 2025

Thanks for the work, @evgaster. I cannot take this PR as is without first ensuring that we can respect the license. At first glance, it looks like I need to be a bit careful.

@evgaster
Copy link
Author

Wanted to discuss "the license" "issue" with you.
I assume you read the copyright / license comment block at the very end of datetime.cc.

Because of that I prefer to keep the needed parts of the SOFA library intact in separate unchanged source files. But that meant changes to the Makefile. As an intermediate step I inserted the routines in datetime.*.

My interpretation of the "copyright / license comment block" is that if we move to using "separate unchanged source files" then there is acknowledgement to do and we're done.

@evgaster
Copy link
Author

At the moment it is "derived work" and we should rename the functions.
I prefer to move to "separate unchanged source files" to get rid of "derived work" and the conditions that apply to that.

@evgaster
Copy link
Author

@c3d what changes do I need to the Makefile to have the compile and build pickup additional files:

  • cal2jd.c
  • jd2cal.c

which depend on:

  • sofa.h
  • sofam.h

I hoped only the below change would do the trick (but it doesn't):

C_SOURCES +=                            \
        src/cal2jd.c                    \
        src/jd2cal.c

Then I can remove the sofa stuff I inserted in datatime.* and only insert #includes for the sofa*.h in datatime.cc. Then we comply with the sofa license.

Before I inserted SOFA source code into src/datetime.*
because I could not get make to pick up additional files.
I found, at least for the simulator, a workaround,
by changing sim/db48x.pro.

Note: it isn't fixed for other builds.
It should be solved by adding the files to the Makefile
but I could not get that to work.

This commit adds:
- src/cal2jd.c
- src/jd2cal.c
- src/sofa.h
- src/sofam.h

They are "intact and unchanged copies of SOFA source code files"
not "derived work".

The previously SOFA source code inserted in src/datetime.* is removed.
Only a #include of the SOFA header files is inserted.

With this approach I believe to comply with SOFA Copyright and license.

ToDo: fix the Makefile or/and other build files.
At the moment that is beyond my competence.
@c3d please look into this.

Signed-off-by: Ed@vanGasteren.net
@evgaster
Copy link
Author

@c3d see this commit concerning your "I need to be a bit careful".

Please help me with the Makefile issue.

Further I don't understand when to use '+' or not in constructs like:

            time_part = +fraction::make(integer::make(time),
                                        +integer::make(scale_from_cc));

copied this from an other part ... but don't fully understand.

Then there is:

        // How on earth do I get the real or double value out of jval?

would appreciate your help with that.

I will look into (twice):

            // ToDo: handle errors.

but again, would appreciate your help with that.

An other round of making this part of the documentation better (I think).

Signed-off-by: Ed@vanGasteren.net
Before the errors of the SOFA funtions where ignored.
Now there is basic error handling in the encapsulating functions.

Signed-off-by: Ed@vanGasteren.net
Signed-off-by: Ed@vanGasteren.net
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants