It is currently April 27th, 2024, 5:52 am

Time zone offset problem

Get help with creating, editing & fixing problems with skins
User avatar
pds
Posts: 79
Joined: April 12th, 2014, 12:52 pm
Location: Slovakia

Time zone offset problem

Post by pds »

I need help with this ?

[MeasureCasCorr]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MeasureRegExp]
StringIndex=1
Substitute="+0100":"3600"

[MeasureFormat1TimestampCorr]
measure=Calc
formula=([MeasureFormat1Timestamp:Timestamp]+[MeasureCasCorr:])
DynamicVariables=1

with this is time increased only about 1 minute not about 1 hour.
Last edited by pds on January 21st, 2016, 6:01 pm, edited 1 time in total.
User avatar
pds
Posts: 79
Joined: April 12th, 2014, 12:52 pm
Location: Slovakia

Re: Time zone offset problem

Post by pds »

jsmorley wrote:What is [MeasureFormat1Timestamp]? If that is not a Time measure, then the :timestamp section variable modifier won't work on it.
MeasureFormat1Timestamp is normal time,if i have formula=([MeasureFormat1Timestamp:Timestamp]+3600) it works ok.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Time zone offset problem

Post by jsmorley »

pds wrote:MeasureFormat1Timestamp is normal time,if i have formula=([MeasureFormat1Timestamp:Timestamp]+3600) it works ok.
You want this:

formula=([MeasureFormat1Timestamp:Timestamp]+[MeasureCasCorr])

WebParser measures just never return any "number" value, and you must use the string value in the Calc measure and let that convert the string number to a number number...

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[MeasureRegExp]
Measure=Plugin
Plugin=WebParser
URL=file://#CURRENTPATH#Test.html
RegExp=(?siU)<offset>(.*)</offset>

[MeasureCasCorr]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MeasureRegExp]
StringIndex=1
Substitute="+0100":"3600"

[MeasureFormat1Timestamp]
Measure=Time
Format=%a, %#d %b %Y %H:%M:%S

[MeasureFormat1TimestampCorr]
measure=Calc
formula=([MeasureFormat1Timestamp:Timestamp]+[MeasureCasCorr])
DynamicVariables=1

[MeasureOffsetTime]
Measure=Time
TimeStamp=[MeasureFormat1TimestampCorr]
Format=%a, %#d %b %Y %H:%M:%S
DynamicVariables=1

[MeterTime]
Meter=String
MeasureName=MeasureFormat1Timestamp
MeasureName2=MeasureOffsetTime
FontSize=13
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=%1 | %2
1.jpg
You do not have the required permissions to view the files attached to this post.
User avatar
pds
Posts: 79
Joined: April 12th, 2014, 12:52 pm
Location: Slovakia

Re: Time zone offset problem

Post by pds »

That gave me an error Calc:Extra operation. I tryed this before.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Time zone offset problem

Post by jsmorley »

pds wrote:That gave me an error Calc:Extra operation. I tryed this before.
The problem is going to be when the skin first is loaded or refreshed, and the value of the WebParser measure is still "". It's not a fatal error, and will only happen once when the skin is refreshed. As soon as the WebParser measure in fact finishes getting the information from the site, the error will go away.

Remember that WebParser is "threaded" and doesn't wait for a result to allow the skin to continue processing. We never want a call to the internet, which can take some time (maybe even a LOT of time in some cases) to "block" the skin. So the initial value of all WebParser measures is "" or an empty string. The skin continues to run while WebParser goes off on its own in a separate thread and does its work. As soon as data from the remote resource is received, WebParser will automatically populate all the child measures, and the information in them will then be available.

Most measures in Rainmeter do in fact "block", and wait for an answer before allowing the skin to continue. This is because the time it takes to get the system time in a Time measure (for instance) basically rounds to zero. So they will have a value immediately in the first skin update. Threaded plugins, like WebParser, FileView, and RunCommand can't assume that an answer will instantly be forthcoming. So they tell the skin "you go ahead on, I'll get back to you when I'm done..."


So what you are getting on the first update of the skin is in effect:

formula=([MeasureFormat1Timestamp:Timestamp]+)

And Calc is complaining, "Plus what??"

Likely by the second skin update (although that is not certain) WebParser has populated the child measures, and you get:

formula=([MeasureFormat1Timestamp:Timestamp]+[MeasureCasCorr])

And Calc says "Oh, OK. I gotcha..."

You can fix the error in the log with:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[MeasureRegExp]
Measure=Plugin
Plugin=WebParser
URL=file://#CURRENTPATH#Test.html
RegExp=(?siU)<offset>(.*)</offset>
FinishAction=[!EnableMeasureGroup "Times"]

[MeasureCasCorr]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MeasureRegExp]
StringIndex=1
Substitute="+0100":"3600"

[MeasureFormat1Timestamp]
Measure=Time
Format=%a, %#d %b %Y %H:%M:%S

[MeasureFormat1TimestampCorr]
measure=Calc
Group=Times
formula=([MeasureFormat1Timestamp:Timestamp]+[MeasureCasCorr])
DynamicVariables=1
Disabled=1

[MeasureOffsetTime]
Measure=Time
Group=Times
TimeStamp=[MeasureFormat1TimestampCorr]
Format=%a, %#d %b %Y %H:%M:%S
DynamicVariables=1
Disabled=1

[MeterTime]
Meter=String
MeasureName=MeasureFormat1Timestamp
MeasureName2=MeasureOffsetTime
FontSize=13
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=%1 | %2
That way you don't try to use the value until WebParser tells you that it has one to use...
User avatar
pds
Posts: 79
Joined: April 12th, 2014, 12:52 pm
Location: Slovakia

Re: Time zone offset problem

Post by pds »

Thanks. But sometning must be wrong because [MeasureCasCorr] gave me 100 instead 3600 i don't know why.

If i look at Measure value there is 3600. weird
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Time zone offset problem

Post by jsmorley »

pds wrote:Thanks. But sometning must be wrong because [MeasureCasCorr] gave me 100 instead 3600 i don't know why.

If i look at Measure value there is 3600. weird
Well, I'm not quite sure. I'd need to see the entire skin code. If you test my example above, it clearly works as you intend, so there has to be some difference. Some reason why it is continuing to see the actual string value of "+0100" (which would be "100" to Calc) instead of the substituted value of "3600".

Perhaps StringIndex 1 isn't returning just "+0100" but "+0100#CRLF# " or " +0100" or "+0100 " or something, so that while it "looks" like the measure's string value is "3600", it really isn't...
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Time zone offset problem

Post by jsmorley »

You might try something like:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[MeasureRegExp]
Measure=Plugin
Plugin=WebParser
URL=file://#CURRENTPATH#Test.html
RegExp=(?siU)<offset>(.*)</offset>
FinishAction=[!EnableMeasureGroup "Times"]

[MeasureCasCorr]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MeasureRegExp]
StringIndex=1
Substitute="+0100":"3600"

[MeterTest]
Meter=String
MeasureName=MeasureCasCorr
FontSize=13
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=>>%1<<

[MeasureFormat1Timestamp]
Measure=Time
Format=%a, %#d %b %Y %H:%M:%S

[MeasureFormat1TimestampCorr]
measure=Calc
Group=Times
formula=([MeasureFormat1Timestamp:Timestamp]+[MeasureCasCorr])
DynamicVariables=1
Disabled=1

[MeasureOffsetTime]
Measure=Time
Group=Times
TimeStamp=[MeasureFormat1TimestampCorr]
Format=%a, %#d %b %Y %H:%M:%S
DynamicVariables=1
Disabled=1

[MeterTime]
Meter=String
Y=10R
MeasureName=MeasureFormat1Timestamp
MeasureName2=MeasureOffsetTime
FontSize=13
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=%1 | %2
Working that [MeterTest] meter into your skin of course. That will display the exact string value being returned by [MeasureCasCorr].
1.jpg
If you get something like:
2.jpg
Then you will need to either fix your RegExp, or change your Substitute to Substitute="+0100":"3600","#CRLF#":"".
You do not have the required permissions to view the files attached to this post.
User avatar
pds
Posts: 79
Joined: April 12th, 2014, 12:52 pm
Location: Slovakia

Re: Time zone offset problem

Post by pds »

Something is wrong. I tryed simple code and still wrong number.
Formula :formula=([MeasureTimeOffset]+[MeasureTimeOffset]) give error (see pic)
Formula :formula=([MeasureTimeOffset:]+[MeasureTimeOffset:]) give 200 not 7200 (see pic)
URL is google calendar basic.ics file, try yours please.

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[MeasureRegExp]
Measure=Plugin
Plugin=WebParser
URL=https://calendar.google.com/calendar/ical/*******/private-*******/basic.ics
RegExp=(?siU).*TZOFFSETFROM:(.*)TZOFFSETTO
FinishAction=[!EnableMeasureGroup "Times"]

[MeasureTimeOffset]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MeasureRegExp]
StringIndex=1
Substitute="#CRLF#":"","+0100":"3600","#CRLF#":""

[MeasureCorr]
measure=Calc
Group=Times
formula=([MeasureTimeOffset]+[MeasureTimeOffset])
DynamicVariables=1
Disabled=1

[MeterTest]
Meter=String
MeasureName=MeasureTimeOffset
FontSize=13
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=>>%1<<
You do not have the required permissions to view the files attached to this post.
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

Re: Time zone offset problem

Post by FreeRaider »

I don't like this solution, but it works

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[MeasureRegExp]
Measure=Plugin
Plugin=WebParser
URL=file://#CURRENTPATH#basic.ics
RegExp=(?siU).*TZOFFSETFROM:\s*(.*)\s*TZOFFSETTO
StringIndex=1
FinishAction=[!EnableMeasureGroup "Times"]

[MeasureTimeOffset]
Measure=String
String=[MeasureRegExp]
DynamicVariables=1
Substitute="+0900":"3600"


[MeasureCalc]
Measure=Calc
Formula=([MeasureTimeOffset] + [MeasureTimeOffset])
DynamicVariables=1
Group=Times
Disabled=1

[MeterTest]
Meter=String
MeasureName=MeasureTimeOffset
FontSize=13
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=>>%1<<