Topic: time storage and formatting
according to the documentation, times are stored in tables such as `posts` as a UNIX timestamp in an INT field.
as far as i know, the UNIX timestamp returned by mysql is seconds since the epoch in UTC.
this begs the question: if the times stored in the database are in UTC, why do you adjust for it in your format_date() function?
function format_time($timestamp, $date_only = false)
{
global $pun_config, $lang_common, $pun_user;
if ($timestamp == '')
return $lang_common['Never'];
$diff = ($pun_user['timezone'] - $pun_config['o_server_timezone']) * 3600;
$timestamp += $diff;
$now = time();
$date = date($pun_config['o_date_format'], $timestamp);
$today = date($pun_config['o_date_format'], $now+$diff);
$yesterday = date($pun_config['o_date_format'], $now+$diff-86400);
if ($date == $today)
$date = $lang_common['Today'];
else if ($date == $yesterday)
$date = $lang_common['Yesterday'];
if (!$date_only)
return $date.' '.date($pun_config['o_time_format'], $timestamp);
else
return $date;
}
you apply the user's timezone and the server's timezone as $diff to $timestamp. but _why_ would you diff the server's timezone if the UNIX timestamp is in UTC anyway?