
Untitled
By: a guest on
Apr 15th, 2012 | syntax:
None | size: 0.41 KB | hits: 3 | expires: Never
-module(time).
-compile([export_all]).
time_to_words({0,0,_}) -> "now";
time_to_words({0,1,_}) -> "1 minute";
time_to_words({0,M,_}) -> integer_to_list(M) ++ " minutes";
time_to_words({1,0,_}) -> "1 hour";
time_to_words({H,0,_}) -> integer_to_list(H) ++ " hours";
time_to_words({H,1,_}) -> integer_to_list(H) ++ "h " ++ "1min";
time_to_words({H,M,_}) -> integer_to_list(H) ++ "h " ++ integer_to_list(M) ++ "mins".