I'm only a few days new at Rainmeter, so bear with me in my proposition, but I found what I think to be a useful alteration to adjust the times to fit a specific timezone. First, I added an extra String Index in the Webparser Parent Measure. This is my alteration to the RegExp:
RegExp=(?siU).*<city id="(.*)".*name="(.*)".*<timezone>(.*)</timezone>.*<sun rise="(.*)".*set="(.*)".*<temperature value="(.*)".*min="(.*)".*max="(.*)".*unit="(.*)".*<humidity value="(.*)".*<pressure value="(.*)".*unit="(.*)".*<speed value="(.*)".*name="(.*)".*<direction value="(.*)".*code="(.*)".*<clouds value="(.*)".*name="(.*)".*<weather number=.*value="(.*)".*icon="(.*)".*<lastupdate value="(.*)"
Then add this Measure after [MeasureCity]:
[MeasureTimezone]
Measure=WebParser
URL=[MeasureValues]
StringIndex=3
Next, you'll have to go through all the following Measures and augment the StringIndex by 1 (i.e. [MeasureHumidity] should have a StringIndex of 10). Now that that's done, you just have to alter the Sunrise/sunset/LastUpdate measures to calculate this. It was a little tricky to figure out, but I was able to separate the hours from the time and adjust that value to be offset by the timezone (I THINK I got the math right on this. Please comment if I overlooked something). Take the [MeasureSunrise] and [MeasureSunset] snippets and replace them with the following:
[MeasureSunriseHourStep1]
Measure=WebParser
URL=[MeasureValues]
StringIndex=4
RegExpSubstitute=1
Substitute="^(.{1,})T(.{1,})+$":"\2","^(.{0,2}).+$":"\1"
[MeasureSunsetHourStep1]
Measure=WebParser
URL=[MeasureValues]
StringIndex=5
RegExpSubstitute=1
Substitute="^(.{1,})T(.{1,})+$":"\2","^(.{0,2}).+$":"\1"
[MeasureSunriseHour]
Measure=Calc
Formula=([MeasureSunriseHourStep1] >= Abs([MeasureTimezone] / 3600) ? [MeasureSunriseHourStep1] + ([MeasureTimezone] / 3600) : ([MeasureSunriseHourStep1] < Abs([MeasureTimezone] / 3600) ? [MeasureSunriseHourStep1] + 24 - Abs([MeasureTimezone] / 3600) : 37))
DynamicVariables=1
[MeasureSunsetHour]
Measure=Calc
Formula=([MeasureSunsetHourStep1] >= Abs([MeasureTimezone] / 3600) ? [MeasureSunsetHourStep1] + ([MeasureTimezone] / 3600) : ([MeasureSunsetHourStep1] < Abs([MeasureTimezone] / 3600) ? [MeasureSunsetHourStep1] + 24 - Abs([MeasureTimezone] / 3600) : 37))
DynamicVariables=1
(Note: 37 is just the random failover number I threw in; you can pick whatever you like). This same pattern should be applied to the [MeasureLastUpdate] snippet as well. In the meters, I then altered [MeterSun] with the following:
Code: Select all
[MeterSun]
Meter=String
MeasureName=MeasureSunriseHour
MeasureName2=MeasureSunsetHour
MeasureName3=MeasureSunriseMin
MeasureName4=MeasureSunsetMin
X=10
Y=20r
FontFace=Cambria
FontColor=255,255,255,255
FontSize=10
StringStyle=Bold
Text=Sunrise: %1%3#CRLF#Sunset: %2%4
Again, do likewise with the [MeterLastUpdate] snippet. I'll reiterate, I am about as fresh as fresh gets when it comes to Rainmeter, and I'm not as much a programmer as I am a network engineer, so suggestions to improve this are highly welcomed. Just throwing this out here to whomever it may help.