Quantcast
Channel: Rainmeter Forums
Viewing all articles
Browse latest Browse all 1538

Help: Rainmeter Skins • Re: Time Conversions

$
0
0
Thanks. I see what is happening there. I was in a bit of a hurry yesterday, but will now try to give more details.

I'm parsing a weather XML, in which most sections have the date/time given in both local time and UTC (with an offset); and I am interested only in the local time. However, in the hourly forecast section, which contains 24 hourly forecasts, the times are given only in UTC (with an offset). So, 24 times I would like to convert from UTC to local time, but am interested only in the hours/minutes; I would like the result to be four digits (including any needed leading zeros).

So there are 24 measures which have 24 consecutive timestamps. Could a substitute be applied to them, to reduce the stamp to the last four digits (hours/minutes), and would that make things easier? And there are 24 measures which have the offset. These, of course, would all be the same offset, unless they transition the DST boundary at one end or the other. The offset will always be negative, since no part of Canada lies east of the prime meridian; however the offset can be fractional, eg. -2.5 (think Newfoundland). So my thought was to multiply the offset by 100 and add that to the timestamp last four digits (eg. 0600 + (-7 * 100) or 2300 + (-2.5 * 100)). [Just realized, a fractional offset would need converting to hours/minutes (eg. -0250 {two-and-a-half hours} becomes -0230 {two hours and thirty minutes}), but as far as I am aware, any fractional part is always one-half hour, so perhaps a substitute on the offset measure could help there?] Then it would need to be checked for becoming negative, and corrected as necessary (no need to check the other direction, since the offset is always negative and could therefore never exceed 2400), and finally zero-padded as required.

Is that a workable approach, or is there an easier way?

Statistics: Posted by qwerky — Today, 8:53 pm



Viewing all articles
Browse latest Browse all 1538

Trending Articles