Local Noon Clock
Posted
#1
(In Topic #281)
Regular

[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
.... and carry a big stick!
Posted
Guru

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
<IMG src="http://www.cogier.com/gambas/Local%20Noon%20Clock.png">
</IMG>
Posted
Regular

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!
Posted
Guru

Posted
Regular

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!
Posted
Regular

.... and carry a big stick!
Posted
Guru

<IMG src="http://www.cogier.com/gambas/Sun.png">
</IMG>This is using the figures collected automatically.
Posted
Regular

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
.... and carry a big stick!
1 guest and 0 members have just viewed this.



