aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/session.php
diff options
context:
space:
mode:
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)