Calendar Calculations Class for Windows

User projects written in or related to FreeBASIC.
Post Reply
rpkelly
Posts: 52
Joined: Sep 03, 2016 22:36

Calendar Calculations Class for Windows

Post by rpkelly »

Calendar date and time calculations on GitHub at:

https://github.com/breacsealgaire/Cale ... Freebasic

cCalendar_Test_Script3.txt updated to remove lunar illumination function. This function returned inconsistent results using the algorithm from Jean Meeus's book Astronomical Algorithms, Chapter 48, page 345.

*** Update ***

Finally figured out the lunar illumination function. I had to 'normalize' the lunar phase to the range 0 - 180 degrees.

Version 1.01

1. Renamed cCalendar.inc to cCalendar.bi
2. FB include folder cCalendar added
3. Function LunarIllumination added
paul doe
Moderator
Posts: 1730
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: Calendar Calculations Class for Windows

Post by paul doe »

This is super useful stuff, as well as being an amazing work. Thanks for sharing!
rpkelly
Posts: 52
Joined: Sep 03, 2016 22:36

Re: Calendar Calculations Class for Windows

Post by rpkelly »

There were still parameters without an explicit BYVAL/BYREF and there were mixed operands not supported by version 1.05 (fixed in version 1.06) which have been addressed via CLNG.

Compiled with 32/64 FB versions 1.05 and 1.06.

I also noted I labeled the class as for WIndows. Since I only develop for Windows, I don't know if other platforms are compatible.

GitHub updated to version 1.02.
rpkelly
Posts: 52
Joined: Sep 03, 2016 22:36

Re: Calendar Calculations Class for Windows

Post by rpkelly »

paul doe wrote:This is super useful stuff, as well as being an amazing work. Thanks for sharing!
You're welcome! I first wrote most of the class with MASM32 in 1997, ported it to Paradox ObjectPal, ported it to Powerbasic, and now this FB version which is the latest incarnation with all the latest calendar stuff I have accumulated over the years. I have another big push planned in 2018.
rpkelly
Posts: 52
Joined: Sep 03, 2016 22:36

Re: Calendar Calculations Class for Windows

Post by rpkelly »

Library updated to version 1.10

https://github.com/breacsealgaire/Calen ... -Freebasic

Changes:

1. Added support for Samaritan calendar
2. Higher precisions for astronomical calculations
3. Separation of functions for moonrise and moonset
4. Additional support for Daylight Savings adjustments
5. Location support added to Function LunarIllumination
6. Support functions cmApparentFromUniversal and cmUniversalFromApparent added
dodicat
Posts: 7976
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Calendar Calculations Class for Windows

Post by dodicat »

Nice work.
An enormous task.
You have
#Include Once "cCalendar\cCalendar.bi"
But you have no cCalendar folder.
..
#Include Once "cCalendar.bi"
does fine here.
rpkelly
Posts: 52
Joined: Sep 03, 2016 22:36

Re: Calendar Calculations Class for Windows

Post by rpkelly »

Thank you, and, I removed the cCalendar folder for the library in the test scripts.
rpkelly
Posts: 52
Joined: Sep 03, 2016 22:36

Re: Calendar Calculations Class for Windows

Post by rpkelly »

The next logical step with the cCalendar class is to add time zone support using the IANA source at https://www.iana.org/time-zones.

I'm thinking of having the parser I am working on emit DATA statements that can be pulled into a class via includes. Updates would be just downloading the latest IANA files and running the parser and updating the includes. The class would then load values into internal arrays that are used for all the function calls.

Any ideas on a better design?
andykmv
Posts: 58
Joined: Feb 12, 2015 9:50

Re: Calendar Calculations Class for Windows

Post by andykmv »

this looks interesting! and that's very nice work on the library.

i was looking at date time stuff this morning (as part of an ongoing project) and happened to be reading about ICU library http://site.icu-project.org/ which at a quick scan seemed to have some relevant stuff in it and draws on the iana library too. had you tried it ? (i was pondering using it for the timezone and date/time conversion utilities)
Post Reply