Linux Today: Linux News On Internet Time.

More on LinuxToday

More Debt Watching from the Command Line

Aug 13, 2009, 23:32 (0 Talkback[s])
(Other stories by Mitch Frazier)


Desktop-as-a-Service Designed for Any Cloud ? Nutanix Frame

"The first function, get_debt(), fetches the debt page from brillig.com and then extracts and cleans up the debt number. The debt number is extracted from the alt attribute of the image at the top of the page. The string there contains spaces and commas and a dollar sign, those are removed to give us a usable number.

"The second function fmt_time() formats a time component for our output. For example, fmt_time 2 second prints "2 seconds", fmt_time 0 second prints "" (an empty string).

"The third function, elapsed_time() takes two time values in seconds and calculates the difference between the two. It then formats the elapsed time in a readable fashion. For example elapsed_time 0 3659 prints "1 hour 59 seconds".

Complete Story

Related Stories: