WordPress.org

Make WordPress Core

Ticket #3962: tz-convert-fix.diff

File tz-convert-fix.diff, 668 bytes (added by Otto42, 5 years ago)

Fixes the sign problem when converting from gmt_offset to new Etc/GMT timezone

  • wp-admin/options-general.php

     
    135135$current_offset = get_option('gmt_offset'); 
    136136$tzstring = get_option('timezone_string'); 
    137137if (empty($tzstring)) { // set the Etc zone if no timezone string exists 
    138         if ($current_offset < 0) $offnum = ceil($current_offset); 
    139         else $offnum = floor($current_offset); 
     138        if ($current_offset < 0) $offnum = - ceil($current_offset); 
     139        else $offnum = - floor($current_offset); 
    140140        $tzstring = 'Etc/GMT' . (($offnum >= 0) ? '+' : '') . $offnum; 
    141141} 
    142142?>