i have decided that storing the dates in UTC is extremely important.
say that your server is UTC-5. all the times in the database are stored as UTC+5. so when you pull the times out, you subtract (3600 * -5) from them to get UTC, then you add the user's timezone. this works fine and it's what both ttf and punbb does.
then you decide to move to a server in the UTC+2 zone. you move the database over. suddenly the times are getting stored as UTC+2 now, so there is an inconsistency! you either have to adjust all of the previous times in the database to UTC+2 or you have to make the software
store the time in the database in UTC. i support the latter.
here's evidence that punbb stores dates in the server time zone and not in UTC:
include/functions.php, lines 593-617:
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;
}
post.php, lines 179-81:
// Insert the new post
$db->query('INSERT INTO '.$db->prefix.'posts (poster, poster_id, poster_ip, message, hide_smilies, posted, topic_id) VALUES(\''.$db->escape($username).'\', '.$pun_user['id'].', \''.get_remote_address().'\', \''.$db->escape($message).'\', \''.$hide_smilies.'\', '.$now.', '.$tid.')') or error('Unable to create post', __FILE__, __LINE__, $db->error());
$new_pid = $db->insert_id();
so here's another area in which ttf can next level over punbb.
you'll also notice that this code that i posted
lacks DST support! how can anyone consider forum software
mature when it doesn't even know what daylight savings time is?
ref:
http://forums.punbb.org/viewtopic.php?id=13130
note:
ttf lacks DST support as well, but i'm working on it. and i also never claim that ttf is mature software. i haven't even released v1 yet!
the "mature software" thing pisses me off because of this:
http://forum.mootools.net/viewtopic.php?id=2347#post-11392
But I guess the software (bbPress) was way too immature and it looks like this replacement is a whole lot better!
now, i also need to convert all of the times in the ttf database to utc.
the last server we were on:
u35884066:~ > date
Sat Apr 14 19:38:26 EDT 2007
u35884066:~ > date -u
Sat Apr 14 23:38:30 UTC 2007
as of 2007/04/14 23:38 UTC as verified by
time.nist.gov
okay, they were already in utc. i cleaned it up a bit with r100. i'm happy for now.
okay, if this guy is right, then my r100 commit wasn't very good:
http://forums.punbb.org/viewtopic.php?pid=91942#p91942