It is currently September 21st, 2020, 3:44 am

Clock face based on the sunset and sunrise

Help with creating, editing & fixing problems with skins
User avatar
balala
Rainmeter Sage
Posts: 11369
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Clock face based on the sunset and sunrise

Post by balala »

jsmorley wrote: June 26th, 2020, 12:05 pm I'm not following this thread closely, but it should be noted that it is:

TimeZone=Local

To have the measure use the computer's local time for the timezone.

Now, that is also the default, so if you use:

TimeZone=Locale

Which is an invalid value for that option, then it's the same as using the valid "Local" value.
There still is something I don't understand. Now, after I dissected a little bit this question, my problem is the following: here is an extremely simple code:

Code: Select all

[Rainmeter]
Update=1000

[MeasureTime]
Measure=Time
Format=%H:%M

[MeterTime]
Meter=STRING
MeasureName=MeasureTime
X=0
Y=0
Padding=15,5,15,5
FontColor=220,220,220
FontEffectColor=0,0,0
StringEffect=Shadow
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=%1
It shows the current local time. Right now for me this is 20:20. If I add a TimeZone=local option to the [MeasureTime] measure, I get the same result: 20:20, which is alright. But if I change the above newly added option to TimeZone=locale, I get 18:20, so with two hour before the curent time, exactly as with TimeZone=0.
The only thing I can think to, is that the default value of the TimeZone option is not local, but 0.
Please investigate: is there something I'm missing at this point?
User avatar
balala
Rainmeter Sage
Posts: 11369
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Clock face based on the sunset and sunrise

Post by balala »

eclectic-tech wrote: June 26th, 2020, 2:29 pm We are not setting the "TimeZone", we are setting a variable "TimeZ". :???:
Which practically is the same thing, because the TimeZ variable is used only on the TimeZone options of five Time measures: [MeasureHour], [MeasureMin], [MeasureSec], [MeasureTime] and [MeasureTime2].
eclectic-tech wrote: June 26th, 2020, 2:29 pm When used as I did, TimeZ=Locale the skin will show the time based on the Latitude/Longitude values in the [Variables] section. So there is something in the code or Lua script that is making it work.
As the time goes by, I more and more tend to think that no, it doesn't use the time based on the geographical coordinates (which doesn't make too much sense, because neither Rainmeter, nor the skin and not even the .lua script can't know what is the correct time zone of the set geographical coordinates), but the time of the TimeZone=0, which now in my opinion seems to be the default value of the TimeZone option, instead of TimeZone=local. Please take a look to my previous reply above. For the case of the set geographical coordinates, this is accidentally correct, but if you set another coordinates (out of the region which has the local time 0), the values returned by the measures are not correct.
As said, neither of Rainmeter, the skin or the .lua script can't know the correct time zone of certain geographical coordinates. There is no such way, I think...
the1ulike
Posts: 26
Joined: June 13th, 2020, 7:55 pm

Re: Clock face based on the sunset and sunrise

Post by the1ulike »

balala wrote: June 26th, 2020, 5:41 pm
As said, neither of Rainmeter, the skin or the .lua script can't know the correct time zone of certain geographical coordinates. There is no such way, I think...
I'm looking at the time zome map. The time zones can not be predicted from the geographical coordinates
Image
User avatar
balala
Rainmeter Sage
Posts: 11369
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Clock face based on the sunset and sunrise

Post by balala »

the1ulike wrote: June 26th, 2020, 7:56 pm I'm looking at the time zome map. The time zones can not be predicted from the geographical coordinates
Well, this is exactly what I said as well. Even if there is a direct connection between the geographical coordinates and time zones (each geographical coordonate has its own time zone), the connection is, well, probably it's quite complicated and can't be calculated. Maybe just found in a table or something.
No, I think the easiest way will be to manually add the time zone, as a variable.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 4112
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Clock face based on the sunset and sunrise

Post by eclectic-tech »

balala wrote: June 26th, 2020, 8:10 pm Well, this is exactly what I said as well. Even if there is a direct connection between the geographical coordinates and time zones (each geographical coordonate has its own time zone), the connection is, well, probably it's quite complicated and can't be calculated. Maybe just found in a table or something.
No, I think the easiest way will be to manually add the time zone, as a variable.
I think you are correct balala.
My suggested change just happened to put the Timezone to zero, which matched the location we were testing.
With the off-line version, I agree with your finding, that manually entering your timezone is the only option.

That was one of the reasons I have used Yandex/Time in several of my time-related skins; it provides the timezone and several other useful items.

I still like both variants of the1ulike's idea!
User avatar
SilverAzide
Posts: 954
Joined: March 23rd, 2015, 5:26 pm

Re: Clock face based on the sunset and sunrise

Post by SilverAzide »

the1ulike wrote: June 26th, 2020, 7:56 pm I'm looking at the time zome map. The time zones can not be predicted from the geographical coordinates
balala wrote: June 26th, 2020, 8:10 pm Well, this is exactly what I said as well. Even if there is a direct connection between the geographical coordinates and time zones (each geographical coordonate has its own time zone), the connection is, well, probably it's quite complicated and can't be calculated. Maybe just found in a table or something.
No, I think the easiest way will be to manually add the time zone, as a variable.
Hi everyone,
I don't mean to intrude on this thread, but I wanted to let you guys know there *IS* a simple way to get time zone data from lat/longs. If you call the weather.com website with the lat/long, it will return a bunch of location data, including the time zone offset from GMT for that location. You can also get the precise sunrise/sunset times for that exact spot, so that might be a simpler way to get your clock to switch backgrounds.

See JSMorley's Weather.com skin for the include templates you need.

On a related topic, I see the discussion of fading in the background based on some sort timer, so it gradually changes from dark to light and vice versa. If you really want the clock to be awesome, you should start the fade process at dawn (before sunrise) and at dusk (before sunset). These values are available on some sites and can also be calculated. In some places (high latitudes, especially now) dawn and dusk last for many hours.
Gadgets Wiki GitHub More Gadgets...
User avatar
balala
Rainmeter Sage
Posts: 11369
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Clock face based on the sunset and sunrise

Post by balala »

eclectic-tech wrote: June 26th, 2020, 10:05 pm That was one of the reasons I have used Yandex/Time in several of my time-related skins; it provides the timezone and several other useful items.
Yes, but unfortunately if you're using Yandex or whatever similar, it is not anymore an offline solution. It definitely is easier, maybe much more elegant, but I wanted to show an offline solution is also possible.
User avatar
balala
Rainmeter Sage
Posts: 11369
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Clock face based on the sunset and sunrise

Post by balala »

SilverAzide wrote: June 27th, 2020, 3:24 am I wanted to let you guys know there *IS* a simple way to get time zone data from lat/longs. If you call the weather.com website with the lat/long, it will return a bunch of location data, including the time zone offset from GMT for that location.
Definitely. But as I said on my last reply, my goal was to get the skin working completely offline. No call of weather.com, or any other website, just local, offline calculations.
I don't know a way to calculate locally the time zone from the geographical coordinates. An offline table with every latitude and longitude might exist, but if it indeed exists, I suppose it is extremely large and hard to be used. Manually entering the time zone is much more easy.