[wp-trac] [WordPress Trac] #24730: Introduce a timezone-retrieval method
WordPress Trac
noreply at wordpress.org
Mon May 27 17:33:26 UTC 2019
#24730: Introduce a timezone-retrieval method
--------------------------------------+-----------------------------
Reporter: rmccue | Owner: SergeyBiryukov
Type: enhancement | Status: reviewing
Priority: normal | Milestone: 5.3
Component: Date/Time | Version:
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses:
--------------------------------------+-----------------------------
Comment (by johnjamesjacoby):
Can we change this line in the `wp_timezone_string()` function:
{{{
$minutes = abs( ( $offset - (int) $offset ) * 60 );
}}}
This bit is exploiting string vs. int type-casting rounding magic to be
multiplied by the remainder.
I think I’d prefer this code to parse the option value as a string
directly, or at least contain some inline docs to explain why this way is
the best/fastest.
Subtracting a variable from itself reads like a copy/paste coding error,
even with the type-cast as a hint that it isn’t an exact-exact
subtraction.
Lastly, instead of `60` the WordPress constant `MINUTE_IN_SECONDS` should
probably be used.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/24730#comment:19>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list