aboutsummaryrefslogtreecommitdiff
path: root/views/default/output/friendlytime.php
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-08-21 23:58:35 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-08-21 23:58:35 +0000
commit8a73785aee3e51c26c65053a4de7c5d7f0ebb673 (patch)
tree41e7e607886b0498a0d8d4dc79df6aaa5094d385 /views/default/output/friendlytime.php
parentb81f168b0bfc298c6eb1c0a2a857311f076c40bd (diff)
downloadelgg-8a73785aee3e51c26c65053a4de7c5d7f0ebb673.tar.gz
elgg-8a73785aee3e51c26c65053a4de7c5d7f0ebb673.tar.bz2
Merged r6586:6587 from 1.7 branch into trunk
git-svn-id: http://code.elgg.org/elgg/trunk@6842 36083f99-b078-4883-b0ff-0f9b5a30f544
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>";