First, let's look at the values returned by each of the measure types:
Measure=Time
The string value returned will be based on the Format option that you define. You do this by using the Time Codes mixed with any text you want, to format the date / time string you desire.
Code: Select all
[MeasureTime]
Measure=Time
Format=%A, %B %#d, %Y at %#I:%M %p
The number value returned will depend a bit.
If you specify a Format option, and that option resolves to a purely "numeric" string, the number value will also be that number.
Code: Select all
[MeasureTime]
Measure=Time
Format=%#I
If you specify a Format option, and that option does not resolve to a purely "numeric" string, the number value of the measure will be zero. If the format resolves to a string that starts with a number, that number will be the numeric value.
Code: Select all
[MeasureTime]
Measure=Time
Format=The hour is: %#I
If you do not specify a Format option, then the string format will default to %H:%M:%S or "24Hours:Minutes:Seconds". The number value will be a Windows Timestamp value, which is the number of seconds the current time is since January 1, 1601.
Code: Select all
[MeasureTime]
Measure=Time
In order to do "date math" with a Time measure, you are going to want to use that Windows Timestamp value. The easiest way to do this is to not use the numeric value of the measure at all, which as you can see can conflict and cause confusion with the Format option on the measure. Instead, you will want to use the value of the measure as a Section Variable, with the :Timestamp modifier on it.
Code: Select all
[MeasureNow]
Measure=Time
Format=%A, %B %#d, %Y at %#I:%M %p
[MeasureYesterday]
Measure=Calc
Formula=([MeasureNow:Timestamp] - 86400)
DynamicVariables=1
[MeasureYesterday] will use the Timestamp value of [MeasureNow] in the formula, 13055675615 in this example, and subtract 86400 seconds, or one day.
The Timestamp option
The Time measure has a TimeStamp option that will allow you to specify the time you want the measure to use. This can just be a number corresponding to a valid Windows Timestamp, like our 13055675615 above, or it can be a formula that creates a valid Windows Timestamp. Note that this is not the same as the :Timestamp modifier on a section variable. That is used to "get" the timestamp value, this is used to "set" it.
Code: Select all
[MeasureNow]
Measure=Time
Format=%A, %B %#d, %Y at %#I:%M %p
[MeasureYesterday]
Measure=Time
TimeStamp=([MeasureNow:Timestamp] - 86400)
Format=%A, %B %#d, %Y at %#I:%M %p
DynamicVariables=1
[MeasureNow] = String value of the Time measure.
[MeasureNow:Timestamp] = Timestamp value of the Time measure.
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
[MeasureNow]
Measure=Time
Format=%A, %B %#d, %Y at %#I:%M %p
[MeasureYesterday]
Measure=Time
TimeStamp=([MeasureNow:Timestamp] - 86400)
Format=%A, %B %#d, %Y at %#I:%M %p
DynamicVariables=1
[MeterTodayAndYesterday]
Meter=String
FontSize=11
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Now: [MeasureNow]#CRLF#Yesterday: [MeasureYesterday]
DynamicVariables=1
Measure=Uptime
The string value returned will be based on the Format option that you define. You do this by using the Uptime Codes mixed with any text you want, to format the uptime string you desire.
Code: Select all
[MeasureUptime]
Measure=Uptime
Format="%4!i! days, %3!i! hours, %2!i! minutes %1!i! seconds"
The number value will always be the number of seconds that have elapsed since the system was restarted. In our example this would be 70686 seconds ago.
Code: Select all
[MeasureUptime]
Measure=Uptime
Format="%4!i! days, %3!i! hours, %2!i! minutes %1!i! seconds"
[MeterUptime]
Meter=String
FontSize=11
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=System restarted [MeasureUptime] ago#CRLF#That is [MeasureUptime:] seconds
DynamicVariables=1
Putting it together
So you might want to use the value returned by the Uptime measure, but instead of displaying how long ago that was, maybe you want to display the date and time the system was restarted at.
We can do that fairly easily by using the capabilities of the Time and Uptime measures we discussed above.
First, let me show the code you might use, then explain a bit.
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
[MeasureUptime]
Measure=Uptime
[MeasureCurrentTimeNumber]
Measure=Time
[MeasureCurrentTimeFormat]
Measure=Time
Format=%A, %B %#d, %Y at %#I:%M %p
[MeasureRebootTime]
Measure=Time
TimeStamp=([MeasureCurrentTimeNumber:] - [MeasureUptime:])
Format=%A, %B %#d, %Y at %#I:%M %p
DynamicVariables=1
[MeterOne]
Meter=String
FontSize=11
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Now: [MeasureCurrentTimeFormat]#CRLF#Restart: [MeasureRebootTime]
DynamicVariables=1
This just gets the uptime with no Format option, which will return a number value of the number of seconds since the system was restarted. It will return a default string value as well, but we won't be using that.
[MeasureCurrentTimeNumber]
This will get the current time, with a number value that is the current Windows Timestamp. It will also return a default string value, but we won't be using that either.
[MeasureCurrentTimeFormat]
This returns the current time with a string value we have nicely formatted as we want using the Time Codes and some text.
[MeasureRebootTime]
This is sort of the meat-and-potatoes of this skin. What we are doing here is getting a nicely formatted date / time string. However, we are using the TimeStamp option, with a formula, that will tell the Time measure to use a time different from the current, and nicely format the time the system was restarted.
Hope this help with an understanding of how string and number values work in the Time and Uptime measures, and gives you some ideas for your own skins.