Make WordPress Core

Changeset 55599


Ignore:
Timestamp:
03/28/2023 02:32:42 PM (14 months ago)
Author:
hellofromTonya
Message:

Date/Time: Revert [55054].

This changeset introduced a regression for partial-hour timezones such as +05:30 UTC which is India and Sri Lanka. How? These timezones are in float. The change made in [55054] type casted them to integer which dropped the decimal for the partial-hour, making the time inaccurate. For example, +05:30 UTC (India and Sri Lanka)'s 'gmt_offset' is 5.5, but with the changeset, it was changed to 5.

Reverting the changeset restores the original state of current_time() and thus resolves the regression.

Props reputeinfosystems, Rarst, hellofromTonya, desrosj, audrasjb, sergeybiryukov, costdev, priethor, francina, nekojonez, codingchicken, cbringmann.
Reviewed by desrosj.
Merges [55598] to the 6.2 branch.
See #57035.
Fixes #57998.

Location:
branches/6.2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/6.2

  • branches/6.2/src/wp-includes/functions.php

    r55492 r55599  
    7373    // Don't use non-GMT timestamp, unless you know the difference and really need to.
    7474    if ( 'timestamp' === $type || 'U' === $type ) {
    75         return $gmt ? time() : time() + ( (int) get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
     75        return $gmt ? time() : time() + (int) ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
    7676    }
    7777
Note: See TracChangeset for help on using the changeset viewer.