Author: bklaas
Date: Mon Jul 19 12:47:10 2010
New Revision: 8964
URL: http://svn.slimdevices.com/jive?rev=8964&view=rev
Log:
Bug: 15766
Description: need leading zeroes for several strings when number < 10
time.wday counts from 1 while strings.txt counts from 0
Modified:
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/Clock/ClockApplet.lua
Modified:
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/Clock/ClockApplet.lua
URL:
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/share/applets/Clock/ClockApplet.lua?rev=8964&r1=8963&r2=8964&view=diff
==============================================================================
--- 7.6/trunk/squeezeplay/src/squeezeplay/share/applets/Clock/ClockApplet.lua
(original)
+++ 7.6/trunk/squeezeplay/src/squeezeplay/share/applets/Clock/ClockApplet.lua
Mon Jul 19 12:47:10 2010
@@ -148,7 +148,7 @@
if self.clock_format_hour == "%I" then
theHour = time.hour % 12
end
- return string.format("%2s", tostring(theHour))
+ return string.format("%02s", tostring(theHour))
end
@@ -161,9 +161,9 @@
function Clock:_getDate(time)
local theDate
if self.clock_format_date == "%d%m%Y" then
- theDate = string.format("%2s", tostring(time.day)) ..
string.format("%2s", tostring(time.month)) .. tostring(time.year)
+ theDate = string.format("%02s", tostring(time.day)) ..
string.format("%02s", tostring(time.month)) .. tostring(time.year)
else
- theDate = string.format("%2s", tostring(time.month)) ..
string.format("%2s", tostring(time.day)) .. tostring(time.year)
+ theDate = string.format("%02s", tostring(time.month)) ..
string.format("%02s", tostring(time.day)) .. tostring(time.year)
end
return theDate
end
@@ -304,7 +304,6 @@
local theMinute = '59'
local theDate = '12312009'
--]]
-
-- draw hour digits
self:DrawClock(string.sub(theHour, 1, 1), 'h1')
self:DrawClock(string.sub(theHour, 2, 2), 'h2')
@@ -534,7 +533,8 @@
local time = os.date("*t")
-- string day of week
- local dayOfWeek = tostring(time.wday)
+ local dayOfWeek = tostring(time.wday - 1)
+
local token = "SCREENSAVER_CLOCK_DAY_" .. dayOfWeek
local dayOfWeekString = self.applet:string(token)
self.today:setValue(dayOfWeekString)
_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/jive-checkins