Formulae for the equation of time, local solar time and daylight savings

Just a draft watch to test some time functions. I have tested them ( in my time zone ) and they seem to work ok. If you get the chance I would love it if you could check to see if the output on the watch is correct for your time zone.

Formulae:

UTC: #DUHZ#:#DUmZ#

UTC day number: ((floor((#DNOW#-946684800000)/86400000)%365)-floor(floor(((#DNOW#-946684800000)/86400000)/365)/4))

Equation of Time, EQT: (floor((-7.659sin((6.24004077+0.01720197((#DNOW#-946728000000)/86400000)%(2pi)))+9.863sin(2*(6.24004077+0.01720197*((#DNOW#-946728000000)/86400000)%(2*pi))+3.5932))*100)/100) in minutes

{ For those who don’t know, the EQT is the correction to account for the small annual shift in the position of the Sun about its mean position. It varies about +/- 16 minutes during the year; +ve means that the sun is ahead of the clock, -ve means that the sun is running late :slight_smile: . The EQT can be used to correct the time given by a sun dial. Equation of time - Wikipedia . This formula is an approximation only. There are better approximaitons but the ones I found require an inverse Tan function which Facer does not appear to have. This formula is typically good to around +/- 44 seconds with the the RMS a little less than half that.}

Mean Sun: (floor((((#WSH#+(#WSm#/60))-(#WRH#+(#WRm#/60)))/2+(#WRH#+(#WRm#/60)))*1000)/1000) hrs

{ This is an approximation for the local solar midday - the local time at which the sun is directly overhead. For an observer in the middle of the timezone, solar midday should occur approximately half way between sunrise and sunset. As the observer moves away from the centre of the time zone the local midday also shifts - that is, solar midday is a function of longitude and the equation of time ( I think that EQT is already taken into account by the published Sunset and Sunset times, so no further correction for EQT should be needed to determine local solar midday). Note that daylight savings delays solar midday by an hour. }

Daylight savings: ((((((#WSH#+(#WSm#/60))-(#WRH#+(#WRm#/60)))/2+(#WRH#+(#WRm#/60))-((-7.659sin((6.24004077+0.01720197((#DNOW#-946728000000)/86400000)%(2pi)))+9.863sin(2*(6.24004077+0.01720197*((#DNOW#-946728000000)/86400000)%(2*pi))+3.5932))/60)))-12)>0.5)

{ This function uses the offset of local solar midday to determine if daylight savings has been addeded to the sunrise and sunset times. That is, it returns true if daylight savings is currently applicable at the observers site. I am not sure how accurate this function is as one moves away from the centre of the timezone. Nor am I certain what it might do with 1/2 time zones. I would love to know if you find that it does or does not work! }

Local solar time: (floor((((#DH#+(#Dm#/60)+(#Ds#/3600))-(((#WSH#+(#WSm#/60))-(#WRH#+(#WRm#/60)))/2+(#WRH#+(#WRm#/60)))+12)%24)*1000)/1000) hrs

{ This is an attempt to come up with an approximation for the local solar time - the time a sundial would display. Again I am not sure if it works outside of the zone I have tested it. I would love to hear from anyone if it works or does not }.

3 Likes

Wow. Nice formulae.

Maybe you could help me with a formula for a visual rotational sunrise/sunset for my mini world simulation project.

Didn‘t found a real working solution jet.

The one in that draft is a simple 24h rotation and not conform to true sunrise/-set. :sob:

Rotational Moonrise/Moonset would be even better but not necessary.

Weather comditions already work fine.

Transparency effects for a visual golden and blue hour are not working perfectly as well…

But you have to have a look at the flashes in stormy mode. They look great already. :smile:

My problem is: i am good in graphics but my math skills are poor.

2 Likes

I will have a go, it will need to make use of the some of the formulae above; if you get a chance it would be great if you could let me know if they work for you and what your timezone is.

I assume the Sun is on a transparent layer all by itself, is that right?

Very cool watch face by the way :+1::+1::+1:

That would be great! Yes, the sun is on a transparent layer. I have as well a centered version.

1 Like

How exactly can i test your formulae? I don‘t own a sundial…,

My timezone is utc +1, i am living in germany.

But we have summertime/wintertime.

1 Like

Can‘t load the watch face for testing, i get the comment „Unpublished“ when i try to send to the smartwatch.

1 Like

Thanks for trying to test my formulae. And yes, I was not expecting you to have a sundial :slight_smile: - I was hoping it would be possible to load the watch and just see if the numbers made sense ( mean time was near midday, daylight savings is correct, etc. ). I’m not sure it is possible to test it without loading it though. Again thanks for trying.

I will look at your function today.

Cheers
Mike

1 Like

This seems to work …

Set rotation to:

($(#DWFHS#/15)>=(#WRH#+(#WRm#/60))&&(#DWFHS#/15)<=(#WSH#+(#WSm#/60))?(75-(((#DWFHS#/15)-(#WRH#+(#WRm#/60)))*(((2 * 75)/((#WSH#+(#WSm#/60))-(#WRH#+(#WRm#/60))))))):180$)

Where:

Sunset and sunrise occur +/- 75 degrees from vertical. If you have a different daylight window arc, replace 75 in the formula above with whatever it is. If you find that the sun appears or disappears abruptly at sunrise or sunset, then increase the value for window size in the formula slightly until the sun gracefully appears/disappears ( that is, try, 76, 77, 78, or whatever )

1 Like

Wow! Awesome! This seems to do the trick. Not tested on the smart watch but i assume it will work fine.

Thanks a lot!

Did you maybe found a trick for the fading sundown/sunrise light effects? The ones i am using are only working in the creator and do silly things on the smart watch.

My formulae:

Sunrise

Starting one hour before sunrise (pink light)
$(#DH#+1)=(#WRH#)?((#Dm#+1)(100/60)):$$(#DH#+1)=(#WRH#+1)?(100-(#Dm#(100/60))):0$

Starting with sunrise (orange light)
$(#DH#)=(#WRH#)?((#Dm#)(100/60)):$$(#DH#)=(#WRH#+1)?(100-(#Dm#(100/60))):0$

Sunset
Starting one hour before sunset (orange light)
$(#DH#+1)=(#WSH#)?((#Dm#+1)(100/60)):$$(#DH#+1)=(#WSH#+1)?(100-(#Dm#(100/60))):0$

Starting with sunset, fadeout 1 h after sunset (pink light)
$(#DH#)=(#WSH#)?((#Dm#)(100/60)):$$(#DH#)=(#WSH#+1)?(100-(#Dm#(100/60))):0$

Maybe you have an idea how to manage…?

Greetings, GAUSS.

2 Likes

You are most welcome :slight_smile:

You might try the following for transparency:

Sunrise:

One hour transition duration ( 0 to 100 and back to 0 ) with start time Sunrise - 1hr:
(($(#DH#+#Dm#/60)>=(#WRH#+(#WRm#/60)-1)&&(#DH#+#Dm#/60)<=(#WRH#+(#WRm#/60)+0)?(100-(100abs(2((#DH#+#Dm#/60)-(#WRH#+(#WRm#/60)))+1))):0$))

Two hour transition, start time Sunrise - 1hr:
(($(#DH#+#Dm#/60)>=(#WRH#+(#WRm#/60)-1)&&(#DH#+#Dm#/60)<=(#WRH#+(#WRm#/60)+1)?(100-(100*abs((#DH#+#Dm#/60)-(#WRH#+(#WRm#/60))-0))):0$))

One hour transition, start time Sunrise:
(($(#DH#+#Dm#/60)>=(#WRH#+(#WRm#/60)-0)&&(#DH#+#Dm#/60)<=(#WRH#+(#WRm#/60)+1)?(100-(100abs(2((#DH#+#Dm#/60)-(#WRH#+(#WRm#/60)))-1))):0$))

Sunset:

One hour transition, start time Sunset -1:
(($(#DH#+#Dm#/60)>=(#WSH#+(#WSm#/60)-1)&&(#DH#+#Dm#/60)<=(#WSH#+(#WSm#/60)-0)?(100-(100abs(2((#DH#+#Dm#/60)-(#WSH#+(#WSm#/60)))+1))):0$))

Two hour transition, start time Sunset -1:
(($(#DH#+#Dm#/60)>=(#WSH#+(#WSm#/60)-1)&&(#DH#+#Dm#/60)<=(#WSH#+(#WSm#/60)+1)?(100-(100*abs((#DH#+#Dm#/60)-(#WSH#+(#WSm#/60))-0))):0$))

One hour transition, start time Sunset:
(($(#DH#+#Dm#/60)>=(#WSH#+(#WSm#/60)-0)&&(#DH#+#Dm#/60)<=(#WSH#+(#WSm#/60)+1)?(100-(100abs(2((#DH#+#Dm#/60)-(#WSH#+(#WSm#/60)))-1))):0$))

They seem to work ok …

Cheers
Mike

By the way, is it possible to have more than one IF THEN ELSE on a line - I thought it was a syntax error?

Well, its not my formula and i am not very good in programming but i wondered as well.

Your transparency formulae are awesome. Didn´t test on the watch yet but they already work fabulous in Creator. I made totally new pictures and the effect is astounding.

The effects are made with a douzend of layers for sky background, landscape color, backlight and cloud illumination

Thanks again for your great help, for sure i will mention your participation when i publish the final result. Without you, the day/night simulation wouldn´t exist.

It´s now done and you should have a closer look at the final result:

Greetings, GAUSS.

2 Likes

That is fantastic, what a wonderful imagination you must have to come up with your ideas; that plus the great skills to realise them - well done!

Thank you very much. I indeed have a lot of pictures and ideas in my head, lol. But as i said, my weak point is programming and mathematics, that’s why i am so thankful for your help.

1 Like