Changeset 13702
- Timestamp:
- 03/15/2010 01:57:36 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/options-general.php
r13663 r13702 192 192 <span> 193 193 <?php 194 // Set TZ so localtime works. 195 date_default_timezone_set($tzstring); 194 196 $now = localtime(time(), true); 195 197 if ( $now['tm_isdst'] ) … … 203 205 $found = false; 204 206 $date_time_zone_selected = new DateTimeZone($tzstring); 207 $tz_offset = timezone_offset_get($date_time_zone_selected, date_create()); 208 $right_now = time(); 205 209 foreach ( timezone_transitions_get($date_time_zone_selected) as $tr) { 206 if ( $tr['ts'] > time()) {210 if ( $tr['ts'] > $right_now ) { 207 211 $found = true; 208 212 break; … … 215 219 __('Daylight saving time begins on: <code>%s</code>.') : 216 220 __('Standard time begins on: <code>%s</code>.'); 217 printf( $message, date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $tr['ts'] ) ); 221 // Add the difference between the current offset and the new offset to ts to get the correct transition time from date_i18n(). 222 printf( $message, date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $tr['ts'] + ($tz_offset - $tr['offset']) ) ); 218 223 } else { 219 224 _e('This timezone does not observe daylight saving time.'); 220 225 } 221 226 } 227 // Set back to UTC. 228 date_default_timezone_set('UTC'); 222 229 ?> 223 230 </span>
Note: See TracChangeset
for help on using the changeset viewer.