aboutsummaryrefslogtreecommitdiff
path: root/views/default/output/friendlytime.php
diff options
context:
space:
mode:
Diffstat (limited to 'views/default/output/friendlytime.php')
-rw-r--r--views/default/output/friendlytime.php44
1 files changed, 1 insertions, 43 deletions
diff --git a/views/default/output/friendlytime.php b/views/default/output/friendlytime.php
index 282d94c41..710079c2a 100644
--- a/views/default/output/friendlytime.php
+++ b/views/default/output/friendlytime.php
@@ -6,49 +6,7 @@
* @uses string $vars['time'] Unix-style epoch timestamp
*/
-$diff = time() - ((int) $vars['time']);
-
-$minute = 60;
-$hour = $minute * 60;
-$day = $hour * 24;
-
-if ($diff < $minute) {
- $friendly_time = elgg_echo("friendlytime:justnow");
-} else if ($diff < $hour) {
- $diff = round($diff / $minute);
- if ($diff == 0) {
- $diff = 1;
- }
-
- if ($diff > 1) {
- $friendly_time = sprintf(elgg_echo("friendlytime:minutes"), $diff);
- } else {
- $friendly_time = sprintf(elgg_echo("friendlytime:minutes:singular"), $diff);
- }
-} else if ($diff < $day) {
- $diff = round($diff / $hour);
- if ($diff == 0) {
- $diff = 1;
- }
-
- if ($diff > 1) {
- $friendly_time = sprintf(elgg_echo("friendlytime:hours"), $diff);
- } else {
- $friendly_time = sprintf(elgg_echo("friendlytime:hours:singular"), $diff);
- }
-} else {
- $diff = round($diff / $day);
- if ($diff == 0) {
- $diff = 1;
- }
-
- if ($diff > 1) {
- $friendly_time = sprintf(elgg_echo("friendlytime:days"), $diff);
- } else {
- $friendly_time = sprintf(elgg_echo("friendlytime:days:singular"), $diff);
- }
-}
-
+$friendly_time = elgg_get_friendly_time($vars['time']);
$timestamp = htmlentities(date(elgg_echo('friendlytime:date_format'), $vars['time']));
echo "<acronym title=\"$timestamp\">$friendly_time</acronym>";