aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/session.php
diff options
context:
space:
mode:
authorChris Smith <toonarmy@phpbb.com>2008-12-23 13:53:13 +0000
committerChris Smith <toonarmy@phpbb.com>2008-12-23 13:53:13 +0000
commit7e95a3ee6c6f09e0440d6375ddd128a329d02058 (patch)
tree7f1c039e086f8d3b5214aed54ca36340ca604c86 /phpBB/includes/session.php
parent79f2dedb51b856f540464ba39c9d3cb839672cdb (diff)
downloadforums-7e95a3ee6c6f09e0440d6375ddd128a329d02058.tar
forums-7e95a3ee6c6f09e0440d6375ddd128a329d02058.tar.gz
forums-7e95a3ee6c6f09e0440d6375ddd128a329d02058.tar.bz2
forums-7e95a3ee6c6f09e0440d6375ddd128a329d02058.tar.xz
forums-7e95a3ee6c6f09e0440d6375ddd128a329d02058.zip
merge in r9090, r9170, r9174, r9179
git-svn-id: file:///svn/phpbb/trunk@9214 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/session.php')
-rw-r--r--phpBB/includes/session.php10
1 files changed, 6 insertions, 4 deletions
diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php
index 6c76bd311c..7e7fbfb8ac 100644
--- a/phpBB/includes/session.php
+++ b/phpBB/includes/session.php
@@ -1984,7 +1984,8 @@ class user extends session
static $date_cache;
$format = (!$format) ? $this->date_format : $format;
- $delta = time() - $gmepoch;
+ $now = time();
+ $delta = $now - $gmepoch;
if (!isset($date_cache[$format]))
{
@@ -2004,10 +2005,11 @@ class user extends session
}
}
- // Show date < 1 hour ago as 'xx min ago'
- if ($delta <= 3600 && $delta && $date_cache[$format]['is_short'] !== false && !$forcedate && isset($this->lang['datetime']['AGO']))
+ // Show date <= 1 hour ago as 'xx min ago'
+ // A small tolerence is given for times in the future and times in the future but in the same minute are displayed as '< than a minute ago'
+ if ($delta <= 3600 && ($delta >= -5 || (($now / 60) % 60) == (($gmepoch / 60) % 60)) && $date_cache[$format]['is_short'] !== false && !$forcedate && isset($this->lang['datetime']['AGO']))
{
- return $this->lang(array('datetime', 'AGO'), (int) floor($delta / 60));
+ return $this->lang(array('datetime', 'AGO'), max(0, (int) floor($delta / 60)));
}
if (!$midnight)