Let's assume the current hour is 11, I would like to output a timestamp like this:
1/9/2019 12:19:19
which is just adding an hour to the current time. Instead I get this:
1/9/2019 00:19:19
bora12 wrote: ↑January 9th, 2019, 7:42 pm
Let's assume the current hour is 11, I would like to output a timestamp like this:
1/9/2019 12:19:19
which is just adding an hour to the current time. Instead I get this:
1/9/2019 00:19:19
Don't do this way. You need an extremely simple Time measure, with no Format set and that one will be used into the TimeStamp option of the [MeasureThen] measure. So, first add a this kind of Time measure:
Then use this measure's numeric value (be careful, because a Time measure has completely different string and numeric values - see below) into the TimeStamp option of the "final" Time measure:
See that here I added one hour (so 3600 seconds) to the numeric value returned by the previously added [MeasureTime] measure: TimeStamp=([MeasureTime:]+3600). In this expression [MeasureTime:] is the numeric value of the [MeasureTime] measure (and using this, makes to must have to add the DynamicVariables=1 option to the measure as well) and there is added 3600. Also see that I set a Format for this option and into this Format as minutes and seconds I added the previously defined #mm_ss# variable.
Along with all this, your code looks in the following form:
One thing I would note is that it is probably not good to get in the habit of using [TimeMeasureName:] to obtain or modify the timestamp value of a Time measure. That can get tricky depending on what you have as the Format option on the Time measure. If there is no Format option, it will return the timestamp as the number value, but if there is one, like Format=%H:%M or some such, then the number value will be the best it can figure out as the numeric value of the value returned by the format, or more likely zero.
In the case of Format=%H:%M, that may for instance return a string of 12:32, which cannot be treated as a valid numeric value, and the number value of the measure will be zero.
You will basically NEVER get the correct result if there is ANY Format option on the Time measure.
It's better to always use [TimeMeasureName:Timestamp] to get the timestamp value of a Time measure as a section variable.
jsmorley wrote: ↑January 9th, 2019, 8:33 pm
One thing I would note is that it is probably not good to get in the habit of using [TimeMeasureName:] to obtain or modify the timestamp value of a Time measure. That can get tricky depending on what you have as the Format option on the Time measure. If there is no Format option, it will return the timestamp as the number value, but if there is one, like Format=HH:MM or some such, then the number value will be the best it can figure out as the numeric value of the value returned by the format, or more likely zero.
In the case of Format=HH:MM, that may for instance return a string of 12:32, which cannot be treated as a valid numeric value, and the number value of the measure will be zero.
You will basically NEVER get the correct result if there is ANY Format option on the Time measure.
It's better to always use [TimeMeasureName:Timestamp] to get the timestamp value of a Time measure as a section variable.
Not sure how this could be used to achieve what bora12 asked for. Could you please post a sample code?
What I'm saying is that it's a bit like using "quotes" around string parameters in bangs. They are not always needed, but it's a good habit to get into, as it will save head-scratching at some point sooner or later.
Note that the numeric value of TimeMeasure1, which has no Format option on it, is in fact the correct timestamp for the current time. The numeric value of TimeMeasure2 on the other hand, which has a Format option, is ZERO. In order to get the timestamp value in that case, you would use [TimeMeasure2:Timestamp] in a formula, and not [TimeMeasure2:] which will return zero.
If I just ALWAYS do that, then I get the correct timestamp value no matter what the Format option is set to:
jsmorley wrote: ↑January 9th, 2019, 9:32 pm
Note that the numeric value of TimeMeasure1, which has no Format option on it, is in fact the correct timestamp for the current time. The numeric value of TimeMeasure2 on the other hand, which has a Format option, is ZERO. In order to get the timestamp value in that case, you would use [TimeMeasure2:Timestamp] in a formula, and not [TimeMeasure2:] which will return zero.
If I do that, then I get the correct timestamp value no matter what the Format option is set to:
Now I think I'm starting to realize what's going on (I hope, but I'm not sure!). A while ago I replied to xenium on a similar topic and suggested him to remove the Format option of a Time measure, to can use the measure into the TimeStamp option of another Time measure. Now I see my mistake. Thank you. I again understood something new (to me).
There is always something to learn with Rainmeter.
I'm very grateful to you. Again.
1) If there is no Format option on a Time measure, the string value will be the result of the default %H:%M:%S and the numeric value will be the Windows timestamp.
2) If there is ANY Format option on a Time measure, the string value will be the result of the formatting code(s) used and the number value will be the number returned by the format IF that is a valid number, like Format=%#H for instance, or ZERO if the Format is not a valid number like Format=%H:%M:%S. It will NEVER return a timestamp number if there is any Format option.
3) If you use a Time measure in a section variable as [MeasureName:] it will return the number value. That MIGHT be a timestamp, or it might be a number that has nothing to do with the timestamp, or most likely, it will be ZERO.
4) If you use a Time measure in a section variable as [MeasureName:Timestamp] it will return the timestamp value. It will ALWAYS return the timestamp value, no matter what any Format option is set to.
jsmorley wrote: ↑January 9th, 2019, 9:54 pm
The rules for the Time measure are like this:
1) If there is no Format option on a Time measure, the string value will be the result of the default %HH:%MM:%SS and the numeric value will be the Windows timestamp.
2) If there is ANY Format option on a Time measure, the string value will be the result of the formatting code(s) used and the number value will be the number returned by the format IF that is a valid number, like Format=%#H for instance, or ZERO if the Format is not a valid number like Format=%HH:%MM:%SS. It will NEVER return a timestamp number if there is any Format option.
3) If you use a Time measure in a section variable as [MeasureName:] it will return the number value. That MIGHT be a timestamp, or it might be a number that has nothing to do with the timestamp, or most likely, it will be ZERO.
4) If you use a Time measure in a section variable as [MeasureName:Timestamp] it will return the timestamp value. It will ALWAYS return the timestamp value, no matter what any Format option is set to.
Thanks for these details. I'll have to keep in my mind and will have to re-read them all over again and again.