From 15a49deda2ab0a64484aab776ed5e128e17e01a0 Mon Sep 17 00:00:00 2001 From: michelvaldrighi Date: Thu, 25 Mar 2004 02:21:40 +0000 Subject: [PATCH] since time_difference is now relative to GMT, we should use gmdate instead of date when adding time_difference git-svn-id: https://develop.svn.wordpress.org/trunk@1001 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/functions.php | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 31c8b22f89..523451d89a 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -49,14 +49,16 @@ function mysql2date($dateformatstring, $mysqlstring, $use_b2configmonthsdays = 1 return $j; } -function current_time($type) { +function current_time($type, $gmt = 0) { $time_difference = get_settings('time_difference'); switch ($type) { case 'mysql': - return gmdate('Y-m-d H:i:s'); + return ($gmt) ? gmdate('Y-m-d H:i:s') + : gmdate('Y-m-d H:i:s', (time() + ($time_difference * 3600)));; break; case 'timestamp': - return time(); + return ($gmt) ? time() + : time() + ($time_difference * 3600); break; } } @@ -457,13 +459,13 @@ function touch_time($edit = 1) { echo '

?
'; $time_adj = time() + ($time_difference * 3600); - $post_date_localtime = get_date_from_gmt($postdata['Date']); - $jj = ($edit) ? mysql2date('d', $post_date_localtime) : date('d', $time_adj); - $mm = ($edit) ? mysql2date('m', $post_date_localtime) : date('m', $time_adj); - $aa = ($edit) ? mysql2date('Y', $post_date_localtime) : date('Y', $time_adj); - $hh = ($edit) ? mysql2date('H', $post_date_localtime) : date('H', $time_adj); - $mn = ($edit) ? mysql2date('i', $post_date_localtime) : date('i', $time_adj); - $ss = ($edit) ? mysql2date('s', $post_date_localtime) : date('s', $time_adj); + $post_date = $postdata['Date']; + $jj = ($edit) ? mysql2date('d', $post_date) : gmdate('d', $time_adj); + $mm = ($edit) ? mysql2date('m', $post_date) : gmdate('m', $time_adj); + $aa = ($edit) ? mysql2date('Y', $post_date) : gmdate('Y', $time_adj); + $hh = ($edit) ? mysql2date('H', $post_date) : gmdate('H', $time_adj); + $mn = ($edit) ? mysql2date('i', $post_date) : gmdate('i', $time_adj); + $ss = ($edit) ? mysql2date('s', $post_date) : gmdate('s', $time_adj); echo ''."\n"; echo "