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

I am replying to this thread, since I was interested in knowing when DST (daylight saving time, Summer Time) is. Reason being, to rotate a 24 city Bezel, but not wanting it to rotate by the UTC-offset.

If I am located in Berlin, then the Bezel should point to “BER” and not “CAI” in summer. My time may change but not my physical zone.

Somehow @mikeoday’s formula did not work for me. So I took a different approach and basically use opacity to overlay the winter bezel with a summer bezel with the Timezone tag #Dz#.

So when it is daylight savings time, the value should be 100, when the following timezones are true:

$#Dz#=ACDT?100:$$#Dz#=ADT?100:$$#Dz#=AEDT?100:$$#Dz#=AKDT?100:$$#Dz#=AMST?100:$$#Dz#=AZOST?100:$$#Dz#=BRST?100:$$#Dz#=CDT?100:$$#Dz#=CDT?100:$$#Dz#=CEST?100:$$#Dz#=CHADT?100:$$#Dz#=CHOST?100:$$#Dz#=CLST?100:$$#Dz#=COST?100:$$#Dz#=EASST?100:$$#Dz#=EDT?100:$$#Dz#=EEST?100:$$#Dz#=EGST?100:$$#Dz#=FKST?100:$$#Dz#=HDT?100:$$#Dz#=HOVST?100:$$#Dz#=IRDT?100:$$#Dz#=LHST?100:$$#Dz#=MDT?100:$$#Dz#=MEST?100:$$#Dz#=NDT?100:$$#Dz#=NZDT?100:$$#Dz#=PDT?100:$$#Dz#=PMDT?100:$$#Dz#=PYST?100:$$#Dz#=SDT?100:$$#Dz#=UYST?100:$$#Dz#=WAST?100:$$#Dz#=WEST?100:$$#Dz#=WGST?100:$

Winter rotation Bezel: (((#DOFST#/60)*15))
Summer rotation Bezel: (((#DOFST#/60)*15)+15)

Bezel:

Watch face (Bezel is off by 15°…):

Related threads:

4 Likes

Wow great work Tom . I did not play at all with the Offset . I always wondered if it changed on the Correct Day but of course it must do . I wonder where you got your list of Zones from . I guess it sorts out the Brazil problem and the Half hour Zones .

2 Likes

It’s fantastic, You definitely merit the titel Master Tom!

1 Like

Sorry I was trying to post this on my phone . I am not sur what to do with the opacity formulas . I obviously put them on bot layers but i am not sure if they are for the summer or the winter . Sorry to be so thick .
.
.

1 Like

Unfortunately the long DST formula does not like a value when the conditions are not met. Normally it should be something like:
$#Dz#=CEST?100:0$

But the “:0” does not seem to work, had to remove the “0”. So opacity does not work as expected.

So what I did was to have the “winter” bezel at opacity 100, and the summer bezel on a layer above, with that long formula above for opacity. I also needed a background to cover the winter bezel, since the bezel is text only. An Arc with the same opacity as the bezel could do.

I opened up inspection of the watch face…

2 Likes

Yeah . Thanks Tom I looked at your Publication . I see your Dual Strategy . I was just getting there with a Blanking ring . Sadly i get the Zone Abbreviation on creator but the zones don t show so it has to go on the watch to show . Great Work . I know where to find a Master Class . Just follow you about .
Yes . In those multi conditional lines you can not have anything after the ELSE colon : .
.
.


2 Likes