1 - 12AM displays as 0AM when using 12 hour clock
This should fix the 0 o'clock AM issue. You can probably come up with a more elegant solution, but this one works...
Replace:
LabelSetText("ClockWindowText", wstring.format(fmt, Clock.hour % ClockSettings.Hours Clock.min Clock.sec
LabelSetTextColor("ClockWindowText", ClockSettings.R, ClockSettings.G, ClockSettings.B)
With:
local TIMEVAR
TIMEVAR = (Clock.hour % ClockSettings.Hours
if ClockSettings.Hours == 12 then
if TIMEVAR == 0 then
TIMEVAR = 12
end
end
LabelSetText("ClockWindowText", wstring.format(fmt, TIMEVAR, Clock.min Clock.sec
LabelSetTextColor("ClockWindowText", ClockSettings.R, ClockSettings.G, ClockSettings.B)
| User | When | Change |
|---|---|---|
| mimicvii | Sun, 12 Oct 2008 16:10:27 | Create |
- 2 comments
- 2 comments
- #2
Kravius Sun, 12 Oct 2008 23:14:20To make Aiiane's life a little easier, here's the cleaned up version of your code. I shot her an e-mail a few days ago with code very similar but it didn't occur to me to create a ticket for it.
Aiiane
Replace line 75 with the following code:
<<code>>local TIMEVAR = Clock.hour % ClockSettings.Hours if TIMEVAR == 0 and ClockSettings.Hours == 12 then TIMEVAR = 12 endLabelSetText("ClockWindowText", wstring.format(fmt, TIMEVAR, Clock.min, Clock.sec)) <</code>>
I'm going to add a copy of the code to the comments for the mod so that the other users can apply the fix while they wait for a new version.
- #1
mimicvii Sun, 12 Oct 2008 16:14:07Bah, the wiki is messing up the code, lets try this again...
Replace the above with:
local TIMEVAR
TIMEVAR = (Clock.hour % ClockSettings.Hours)
if ClockSettings.Hours == 12 then
if TIMEVAR == 0 then
TIMEVAR = 12
end
end
LabelSetText("ClockWindowText", wstring.format(fmt, TIMEVAR, Clock.min, Clock.sec))
LabelSetTextColor("ClockWindowText", ClockSettings.R, ClockSettings.G, ClockSettings.B)