- if ($age > 60*60*24*365*2) {
- $co{'age_string'} = (int $age/60/60/24/365);
- $co{'age_string'} .= " years ago";
- } elsif ($age > 60*60*24*(365/12)*2) {
- $co{'age_string'} = int $age/60/60/24/(365/12);
- $co{'age_string'} .= " months ago";
- } elsif ($age > 60*60*24*7*2) {
- $co{'age_string'} = int $age/60/60/24/7;
- $co{'age_string'} .= " weeks ago";
- } elsif ($age > 60*60*24*2) {
- $co{'age_string'} = int $age/60/60/24;
- $co{'age_string'} .= " days ago";
- } elsif ($age > 60*60*2) {
- $co{'age_string'} = int $age/60/60;
- $co{'age_string'} .= " hours ago";
- } elsif ($age > 60*2) {
- $co{'age_string'} = int $age/60;
- $co{'age_string'} .= " min ago";
- } elsif ($age > 2) {
- $co{'age_string'} = int $age;
- $co{'age_string'} .= " sec ago";
- } else {
- $co{'age_string'} .= " right now";
- }