I found a countdown timer on this site which works well in linux, but I need this exact thing done in Ruby. I am new to ruby so having trouble figuring this out.
==Linux version==
seconds=20; date1=$((`date +%s` + $seconds));
while [ "$date1" -ne `date +%s` ]; do
echo -ne "$(date -u --date @$(($date1 - `date +%s` )) +%H:%M:%S)\r";
done
So far I have tried this which does not give me the desired output
t = Time.now
seconds = 30
date1 = (t + seconds)
while t != date1
puts t
sleep 1
end
This gives an output like this which A) is not counting down and B) has date added which I don't want.
2015-05-28 09:57:18 -0500
2015-05-28 09:57:18 -0500
2015-05-28 09:57:18 -0500
2015-05-28 09:57:18 -0500
I want it to output like the linux version which looks like this
00:00:30
00:00:29
00:00:28