Tell me if it is possible to implement
Measure=Calc or something else,
the time obtained in unix code (but then it is translated into a simple time value) with real time?
I would like my skin to run in the interval between unix time and real time the rest of the time is silent.
It is currently March 28th, 2024, 10:35 pm
IfCondition=[MeasureUnixTime] > [MeasureRealTime]
-
- Posts: 33
- Joined: April 20th, 2021, 4:15 pm
-
- Posts: 860
- Joined: August 22nd, 2016, 11:32 pm
- Location: Surrey, B.C., Canada
Re: IfCondition=[MeasureUnixTime] > [MeasureRealTime]
maybe this would be what you need https://docs.rainmeter.net/snippets/convert-time/
The only source of knowledge is experience. Albert Einstein
Deviant Art Page
Deviant Art Page
-
- Posts: 33
- Joined: April 20th, 2021, 4:15 pm
Re: IfCondition=[MeasureUnixTime] > [MeasureRealTime]
I'm not very good at this, but I tried to gather information and do it without success.
I did WinToUnix.lua file
Then he added this:
After that I would like to compare the resulting value with what I get from WebParser
I did WinToUnix.lua file
Code: Select all
function ConvertTime(n, To)
local Formats = {
Unix = -1
Windows = 1
}
return Formats[To] and n + 11644473600 * Formats[To] or nil
end
Code: Select all
[MeasureTimeReal]
Measure=Time
Format=%H:%M
[MeasureScript]
Measure=Script
ScriptFile=WinToUnix.lua
Disabled=1
[MeterWelcome]
Meter=String
FontSize=20
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=[&MeasureScript:ConvertTime('[&MeasureTimeReal]')]
DynamicVariables=1
After that I would like to compare the resulting value with what I get from WebParser
-
- Developer
- Posts: 22628
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: IfCondition=[MeasureUnixTime] > [MeasureRealTime]
Let me get the lay of the land here a bit...
So what you get from WebParser is a Unix timestamp value like 1619777739 or some such?
And you want to compare that to the current time?
Unless I'm misunderstanding, I don't think Lua needs to play a role in this.
So what you get from WebParser is a Unix timestamp value like 1619777739 or some such?
And you want to compare that to the current time?
Unless I'm misunderstanding, I don't think Lua needs to play a role in this.
-
- Posts: 33
- Joined: April 20th, 2021, 4:15 pm
Re: IfCondition=[MeasureUnixTime] > [MeasureRealTime]
Yes, everything is correct, as you described.jsmorley wrote: ↑April 30th, 2021, 10:16 am Let me get the lay of the land here a bit...
So what you get from WebParser is a Unix timestamp value like 1619777739 or some such?
And you want to compare that to the current time?
Unless I'm misunderstanding, I don't think Lua needs to play a role in this.
At this stage, I didn't understand how to convert standard time to unix, so I had to do this:
Code: Select all
[InfoUnixTime]
Measure=WebParser
URL=https://converter.by/unixtime
UpdateRate=#UpdateTime#
RegExp="(?siU)<span class="btn btn-dark-green current-unix-time" id="current-unix-time">(.*)</span>"
UpdateDivider=-1
DynamicVariables=1
[MeasureInfoUnixTime]
Measure=WebParser
URL=[InfoUnixTime]
StringIndex=1
;RegExpSubstitute=1
DynamicVariables=1
UpdateDivider=-1
Like something like that:
Code: Select all
[Meter]
Meter=String
IfCondition==(#UnixTime# > [MeasureInfoUnixTime])
IfTrueAction=[!RainmeterHideMeter MeterIconEmpty][!RainmeterShowMeter MeterIconFull][!RainmeterShowMeter MeterCount]
IfFalseAction=[!RainmeterHideMeter MeterIconFull][!RainmeterShowMeter MeterIconEmpty][!RainmeterHideMeter MeterCount]
DynamicVariables=1
Last edited by MaestroSky on April 30th, 2021, 10:34 am, edited 2 times in total.
-
- Developer
- Posts: 22628
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: IfCondition=[MeasureUnixTime] > [MeasureRealTime]
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
[Variables]
[MeasureUnixTimeStamp]
; This simulates a WebParser measure
Measure=String
String=1619777739
[MeasureUnixTimeToWindows]
Measure=Time
Timestamp=([MeasureUnixTimeStamp]+11644473600)
Format=%A, %B %#d, %Y %#I:%M %p
DynamicVariables=1
[MeasureCurrentTime]
Measure=Time
Format=%A, %B %#d, %Y %#I:%M %p
[MeasureDifferenceInSeconds]
Measure=Calc
Formula=[MeasureUnixTimeToWindows:Timestamp] - [MeasureCurrentTime:TimeStamp]
DynamicVariables=1
[MeasureDifferenceFormatted]
Measure=UpTime
SecondsValue=[MeasureDifferenceInSeconds]
Format="%4!i!d %3!i!h %2!i!m %1!i!s"
DynamicVariables=1
[MeterDummy]
Meter=String
You do not have the required permissions to view the files attached to this post.
-
- Posts: 33
- Joined: April 20th, 2021, 4:15 pm
Re: IfCondition=[MeasureUnixTime] > [MeasureRealTime]
In this case, there is a real-time conversion of unixjsmorley wrote: ↑April 30th, 2021, 10:33 amCode: Select all
[Rainmeter] Update=1000 DynamicWindowSize=1 AccurateText=1 [Variables] [MeasureUnixTimeStamp] ; This simulates a WebParser measure Measure=String String=1619777739 [MeasureUnixTimeToWindows] Measure=Time Timestamp=([MeasureUnixTimeStamp]+11644473600) Format=%A, %B %#d, %Y %#I:%M %p DynamicVariables=1 [MeasureCurrentTime] Measure=Time Format=%A, %B %#d, %Y %#I:%M %p [MeasureDifferenceInSeconds] Measure=Calc Formula=[MeasureUnixTimeToWindows:Timestamp] - [MeasureCurrentTime:TimeStamp] DynamicVariables=1 [MeasureDifferenceFormatted] Measure=UpTime SecondsValue=[MeasureDifferenceInSeconds] Format="%4!i!d %3!i!h %2!i!m %1!i!s" DynamicVariables=1 [MeterDummy] Meter=String
1.png
And I need the opposite.
-
- Developer
- Posts: 22628
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: IfCondition=[MeasureUnixTime] > [MeasureRealTime]
I don't understand.MaestroSky wrote: ↑April 30th, 2021, 10:42 am In this case, there is a real-time conversion of unix
And I need the opposite.
-
- Developer
- Posts: 22628
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: IfCondition=[MeasureUnixTime] > [MeasureRealTime]
I can't see what possible difference it makes if you convert the Unix timestamp to Windows, or the Windows timestamp to Unix, the goal here is presumably to get both times into a common timestamp value, since you want to compare them. Either way is certainly possible, but I don't see the difference.
-
- Posts: 33
- Joined: April 20th, 2021, 4:15 pm
Re: IfCondition=[MeasureUnixTime] > [MeasureRealTime]
You have specified how to translate from unix to the present time. And I need the opposite, from now on in unix.
Last edited by MaestroSky on April 30th, 2021, 11:01 am, edited 1 time in total.