ForSundial, a hobby astronomy project hosted on

ForSundial is a long term hobby project, I won’t say a dream, but something that comes back regularly in my life: building a sundial. There is no special reason to use Fortran rather than any other language, as the computation is really not intensive! Just a few trigonometric formulas are needed, and a few loops. But there is no reason to use another language if you like Fortran.

For SVG drawing, I could probably have used some SVG library written in Fortran but I have used instead the Cairo library, via the fpm dependency cairo-fortran. Firstly because I am used to it since 2011, secondly because it handles fonts, which is useful for writing numbers and text on the sundial.

Many types of sundial exist. This project draws an horizontal sundial for you latitude. In fact, for the moment, it is designed for the Northern Hemisphere, especially between the tropic of Cancer and the North polar circle. Adapting it for the Southern Hemisphere should probably be rather simple (just inverting the cardinal points and the positions of the hours?) Let me know your thoughts (a link to a photo of a sundial in the Southern Hemisphere would be instructive).

On the left a prototype built in 2023 using our Trotec Speedy 400 laser cutting machine, and on the right a SVG file generated with the latest version of the project:

During the day, the shadow of the style (short in Summer, long in Winter) is traveling along an hyperbola, which is reduced to a line at the equinoxes. The extreme hyperbolas are for the Summer and Winter solstices. Sundials are an interesting way to do astronomy, like before Galileo Galilei. No telescope needed and no light pollution problem!

Hosted on

Following that thread about GitHub, I wanted to experiment another forge. The promising is 100% free (the Forgejo software + the forge itself), as in freedom and free beer (although hosting for free implies of course donations for running the infrastructure, as Codeberg e.V. is a nonprofit organization). It is based in Berlin (Germany): Codeberg could be translated in English by “Codemountain”.

You can test ForSundial like with any other forge based on git:

$ git clone

and if it were a library (which it is not), you could of course add it in the [dependencies] section of your fpm project, even if it is hosted elsewhere.

Of course, if you want to participate to the project (issues, pull requests, etc.) you will need to create an account on the forge. Maybe in the future we will have free forges with some kind of interoperability, like in the Fediverse: a pull request is a pull request and an issue is an issue. All the functionalities I need are available on Codeberg and the interface is so similar to that of GitHub or GitLab that it is very easy to take in hand. Well, that is an interesting experience: I am on GitHub since 2011, and I now know the only reason why I am still there: for the Fortran community.


A useful sundial has an analemma or the equivalent so that the user can correct for what is quaintly called the equation of time. @vmagnin’s example doesn’t have one. Is it the intention to provide one?


Yes, it is in the file. I could work on it in the next months, or later… (a long term project as I said :slight_smile: )

Timely. I’ve been figuring out how to compute exact positions of the Sun (and Moon and planets) on the sky, using the exact JPL-computed trajectories, here is what I have so far: python-skyfield/examples/ at fd5c4a9c6c5de680204865a5884d063b8cc3378c · certik/python-skyfield · GitHub, I am “unpacking” the API layers that the (great) Python skyfield library added on top, and just want the raw computation, so that I can rewrite it to some simple Fortran code.

So for any given time, I can tell you the exact altitude and azimuth of the Sun on the sky, given your coordinates.

And from that your code starts, to compute the exact orientation and shapes of everything in the sundial.

Ultimately what I want is a simple reference Fortran implementation that actually computes the trajectories, but I don’t know yet how much physics must be included. The JPL-based trajectories contain incredible number of physics models, but I wonder if one can get a very decent accuracy with simple computation.

1 Like

Interesting, thanks for sharing. I will have a look to that subject.

Yes, their objective is to navigate into the solar system, they need very high precision for their automatic probes to approach bodies, billions miles away. But seen from the Earth ground, we commonly don’t need so much precision concerning those so far heavenly bodies. Anyway we will be limited by things like atmosphere turbulence or optical resolution…

1 Like

Queen Victoria Museum & Art Gallery, Tasmania/Australia: picture and activity sheet to print:


sundials depicts two other, small ones in Christchurch, South Island of New Zealand.

As for the analemma computation: could this page with implementations in C, C++, Fortran90, Matlab, and Python; or this one in Perl help? The topic still enjoys publication in the journals.

1 Like

Thanks a lot for sharing. The photo and activity sheet are interesting for me as they seem to confirm my first idea for the other hemisphere: “just inverting the cardinal points and the positions of the hours” (it may seem evident after thinking but seeing it for real is another thing). Historically, probably clocks are moving clockwise because in the North Hemisphere the shadow is turning clockwise. In the Southern hemisphere, it is counter-clockwise.

I will keep your links preciously for my futur work on the project. For the analemma, the equations are well known, and the main difficulty is to find time (our great master!) to write a subroutine and to make a nice drawing in SVG with numbers on the axis, and to find the place to put it on the sundial. Not a huge work, but time is rare… And of course, the interest of that work is not only to write a program using formulas but to really understand each equation (else I could probably find an app on the web that do the whole job, but it won’t be fun for me :grin:).