Local Noon Clock
Local Noon Clock
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
Last edited by Cedron on Monday 19th August 2019 4:15pm, edited 1 time in total.
.... and carry a big stick!
- cogier
- Site Admin
- Posts: 1125
- Joined: Wednesday 21st September 2016 2:22pm
- Location: Guernsey, Channel Islands
Re: Local Noon Clock
That was a genuine wow 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
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
Re: Local Noon Clock
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.
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.
.... and carry a big stick!
- cogier
- Site Admin
- Posts: 1125
- Joined: Wednesday 21st September 2016 2:22pm
- Location: Guernsey, Channel Islands
Re: Local Noon Clock
Is that better, I got the numbers the wrong way round!
Re: Local Noon Clock
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.
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.
.... and carry a big stick!
- cogier
- Site Admin
- Posts: 1125
- Joined: Wednesday 21st September 2016 2:22pm
- Location: Guernsey, Channel Islands
Re: Local Noon Clock
I have made the Longitude and Latitude selection easier. The picture above has been updated as today shows: -
This is using the figures collected automatically.
This is using the figures collected automatically.
Re: Local Noon Clock
I think this one may be Farm ready.
Ced
.... and carry a big stick!