Author: bklaas
Date: Tue Jul 20 08:54:02 2010
New Revision: 8971
URL: http://svn.slimdevices.com/jive?rev=8971&view=rev
Log:
Fixed Bug: 16373
Description: don't use string.format() for adding leading zeroes to numbers
because it does not work on some platforms
add _padString() method to manually add a leading zero for numbers < 10
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=8971&r1=8970&r2=8971&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
Tue Jul 20 08:54:02 2010
@@ -148,22 +148,30 @@
if self.clock_format_hour == "%I" then
theHour = time.hour % 12
end
- return string.format("%02s", tostring(theHour))
-
-end
-
+ return self:_padString(theHour)
+
+end
+
+function Clock:_padString(number)
+ if number < 10 then
+ return "0" .. tostring(number)
+ else
+ return tostring(number)
+ end
+end
function Clock:_getMinute(time)
- return string.format("%02s", tostring(time.min))
+ return self:_padString(time.min)
end
function Clock:_getDate(time)
local theDate
if self.clock_format_date == "%d%m%Y" then
- theDate = string.format("%02s", tostring(time.day)) ..
string.format("%02s", tostring(time.month)) .. tostring(time.year)
+ theDate = self:_padString(time.day) ..
self:_padString(time.month) .. tostring(time.year)
+
else
- theDate = string.format("%02s", tostring(time.month)) ..
string.format("%02s", tostring(time.day)) .. tostring(time.year)
+ theDate = self:_padString(time.month) ..
self:_padString(time.day) .. tostring(time.year)
end
return theDate
end
@@ -547,7 +555,7 @@
widget:setValue(dayOfMonth)
-- string month of year
- token = "SCREENSAVER_CLOCK_MONTH_" .. string.format("%02s",
tostring(time.month))
+ token = "SCREENSAVER_CLOCK_MONTH_" .. self:_padString(time.month)
local monthString = self.applet:string(token)
widget = self.dateGroup:getWidget('month')
widget:setValue(monthString)
_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/jive-checkins