diff --git a/main.lua b/main.lua
index 9c0f3df..86d63ff 100644
--- a/main.lua
+++ b/main.lua
@@ -51,10 +51,11 @@ function displayTime()
words = display_timestat(time.hour, time.minute)
local charactersOfTime = display_countcharacters_de(words)
+ local wordsOfTime = display_countwords_de(words)
ledBuf = generateLEDs(words, color, color1, color2, color3, color4,
charactersOfTime)
- print("Local time : " .. time.year .. "-" .. time.month .. "-" .. time.day .. " " .. time.hour .. ":" .. time.minute .. ":" .. time.second .. " in " .. charactersOfTime .. " chars")
+ print("Local time : " .. time.year .. "-" .. time.month .. "-" .. time.day .. " " .. time.hour .. ":" .. time.minute .. ":" .. time.second .. " in " .. charactersOfTime .. " chars " .. wordsOfTime .. " words")
-- Write the buffer to the LEDs
ws2812.write(ledBuf)
diff --git a/wordclock.lua b/wordclock.lua
index a7e5be2..e930f43 100755
--- a/wordclock.lua
+++ b/wordclock.lua
@@ -139,7 +139,7 @@ end
-- @fn display_countcharacters_de
-- Count the amount of characters, used to describe the current time in words
-- @param words the same structure, as generated with the function @see display_timestat
--- @return the amount of words, used to describe the time or 0
on errors
+-- @return the amount of characters, used to describe the time or 0
on errors
function display_countcharacters_de(words)
local amount=0
if (words.itis == 1) then
@@ -214,3 +214,17 @@ function display_countcharacters_de(words)
return amount
end
+
+-- @fn display_countcharacters_de
+-- Count the amount of words, used to describe the current time in words
+-- @param words the same structure, as generated with the function @see display_timestat
+-- @return the amount of words, used to describe the time or 0
on errors
+function display_countwords_de(words)
+ local amount = 0
+ for k,v in pairs(words) do
+ if (v ~= nil and v == 1) then
+ amount = amount + 1
+ end
+ end
+ return amount
+end