Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 15th, 2012  |  syntax: None  |  size: 0.41 KB  |  hits: 3  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. -module(time).
  2. -compile([export_all]).
  3.  
  4. time_to_words({0,0,_}) -> "now";
  5. time_to_words({0,1,_}) -> "1 minute";
  6. time_to_words({0,M,_}) -> integer_to_list(M) ++ " minutes";
  7. time_to_words({1,0,_}) -> "1 hour";
  8. time_to_words({H,0,_}) -> integer_to_list(H) ++ " hours";
  9. time_to_words({H,1,_}) -> integer_to_list(H) ++ "h " ++ "1min";
  10. time_to_words({H,M,_}) -> integer_to_list(H) ++ "h " ++ integer_to_list(M) ++ "mins".