Page 1 of 1

Local Noon Clock

Posted: Wednesday 5th June 2019 12:58pm
by Cedron
LocalNoonClock-0.0.1.tar.gz
(15.67 KiB) Downloaded 395 times
[Edit: The subsequent version posted below is better.]

So, I was messing around with dates in Gambas with a SQLite database. The issue of UTC vs Local time is important to keep straight, thus I wrote this little program to help me with some time visualization. It is sort of a screen saver. Launch it when you leave, click on it (or hit [Esc]) to close it.

It's a clock with a different design. When you first run it, you will be asked for your Longitude and Latitude. These get save to a Settings file if you need to change them later. (Found in ~/.config/gambas3/LocalNoonClock.conf)

The outer ring is for hours. The outer scale is UTC hours and the inner scale is local hours. The ring is oriented so that "true noon", defined as half way between sunrise and sunset, is placed at the top. There are 24 hours in the ring so it goes around once a day instead of twice a day like a traditional clock. The blue arc at the bottom indicates the time range between sunset and sunrise, e.g. night time. The yellow arc on top indicates the "safety zone" of plus or minus two hours from true noon you are supposed to avoid the sun.

The inner ring is for minutes. It is the same for UTC and Local time. The clock updates every five seconds.

The green inner LCD display is Local time.

Hope you like it.

Ced

Re: Local Noon Clock

Posted: Wednesday 5th June 2019 2:53pm
by cogier
That was a genuine wow :o moment when I ran your code. Very interesting, have you got a degree in maths?
I thought I would play around with the code so I have: -

ESC now toggles between full screen and not
The font now changes size depending on the size of the form
Slight change to the LCD display
Reduced the drawing size a little as did not always fit on less that full screen
Pressing 'B' while not in full screen mode will toggle the form's border
Added logo

Image
LocalNoonClock.tar.gz
(82.9 KiB) Downloaded 400 times

Re: Local Noon Clock

Posted: Wednesday 5th June 2019 3:40pm
by Cedron
Thanks for the fix up, I'm glad you liked it. I resisted the temptation of color coding the 5 minute dots according to a color wheel.

Yes, I have a degree in Math, but I didn't do any of the equations in the SolarTime class. I left a reference in the code to the source of those equations. Kind of complicated actually. They seemed to work correctly so I didn't validate them any further than that.

The values in your screen capture confuse me a bit. By the length of the night, it looks like you entered the equator for your latitude. Your true noon occurring before 10 in the morning looks a little suspect too.

Where I am at Lon~ -85 and Lat~ 42.5, with a system timezone offset of 4 hours, true noon, aka midday, occurs at 1:38 pm local time, and 17:38 UTC.

Re: Local Noon Clock

Posted: Wednesday 5th June 2019 4:17pm
by cogier
Is that better, I got the numbers the wrong way round!

Re: Local Noon Clock

Posted: Wednesday 5th June 2019 4:39pm
by Cedron
No, it still doesn't look right.

For your location, I entered

Longitude="-2.65"
Latitude="49.5"

which I got by looking up "Guernsey, Channel Islands" on a popular internet web map site.

Of course, my system Timezone is off, so the numbers in the second column are off by a displacement, but the UTC numbers are valid.

Sunrise = 4.10722772182563 00:06
Noon = 12.1533128698554 08:09
Sunset = 20.1993980178852 16:11

So you must have Daylight Savings time going as well and your local figures should be:

Sunrise 5:06 am
True Noon 1:09 pm
Sunset 9:11 pm

Anyway, with those coordinates entered, the UTC scale should have 12 near the top, and 0 near dead bottom.

Re: Local Noon Clock

Posted: Wednesday 5th June 2019 5:04pm
by Cedron
Yes, it's looking good now.

Re: Local Noon Clock

Posted: Thursday 6th June 2019 2:42pm
by cogier
I have made the Longitude and Latitude selection easier. The picture above has been updated as today shows: -

Image

This is using the figures collected automatically.
LocalNoonClock.tar.gz
(86.08 KiB) Downloaded 401 times

Re: Local Noon Clock

Posted: Thursday 6th June 2019 5:52pm
by Cedron
LocalNoonClock-0.0.2.tar.gz
(78.32 KiB) Downloaded 502 times
Thanks for the updates. I've incorporated them and added a few more (listed in the source).

I think this one may be Farm ready.

Ced
Screenshot-Local Noon Clock-1.png
Screenshot-Local Noon Clock-1.png (49.21 KiB) Viewed 9065 times