[wp-hackers] Re: Sqlite

David Chait davebytes at comcast.net
Fri Jun 24 19:37:38 GMT 2005


Ahhh, okay, there are two completely different threads going on here.

One was about storing as unix timestamps instead of mysql DATETIME.  The 
other, apparently, was about storing the timezone offset at time of post 
rather than the gmt timestamp at time of post.

For the former, I'm all for it.  Go to timestamps, nix DATETIME, makes it 
easier for alternate DB systems.

For the latter, I can't say I care much either way.  A gmt offset is only 24 
values (okay, 48 if you want half-hours), which is under a single byte.  A 
timestamp is at least a 4-byte value.  I don't know that saving three bytes 
per post makes any difference versus the constant recalc time, so I'm 
probably with mr. house on this one.  SO, just store a gmt unix timestamp as 
well!  All done? ;)

-d

----- Original Message ----- 
From: "David House" <dmhouse at gmail.com>
To: <wp-hackers at lists.automattic.com>
Sent: Friday, June 24, 2005 3:14 PM
Subject: Re: [wp-hackers] Re: Sqlite


On 6/24/05, Jeff Minard <jeff at jrm.cc> wrote:
> So instead of:
>
>         date($blog_date_format, $post_date)

Actually, instead of doing mysql2date($blog_date_format,
$post_date_gmt), you do date($blog_date_format, $post_date_gmt).
mysql2date() does a lot of string processing which is actually
relatively cheap, but if sqlite support is a plus side, I'd vote yes
for moving toward timestamp dates. I'm still for storing post_date and
post_date_gmt rather than post_date and post_timezone_offset, though;
it makes things simpler because you only have to add the offset once
(at INSERT time), rather than every time the page loads (SELECT time).

We'd have to recode mysql2date to recognise timestamps, but that's not
hard. In the spirit of talk less and code more, here's a diff:

@@ -17,10 +17,6 @@

 function mysql2date($dateformatstring, $mysqlstring, $translate = true) {
  global $month, $weekday, $month_abbrev, $weekday_abbrev;
+
+ if (is_numeric($mysqlstring))
+ return date($dateformatstring, $mysqlstring);
+
  $m = $mysqlstring;
  if (empty($m)) {
  return false;

-- 
-David House, dmhouse at gmail.com, http://xmouse.ithium.net
_______________________________________________
wp-hackers mailing list
wp-hackers at lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list