[wp-trac] [WordPress Trac] #9588: time() is not GMT time()
WordPress Trac
wp-trac at lists.automattic.com
Mon Jan 4 22:24:05 UTC 2010
#9588: time() is not GMT time()
--------------------------------+-------------------------------------------
Reporter: Denis-de-Bernardy | Type: defect (bug)
Status: reopened | Priority: normal
Milestone: 3.0 | Component: Date/Time
Version: 2.8 | Severity: normal
Resolution: | Keywords: has-patch needs-testing
--------------------------------+-------------------------------------------
Comment(by Otto42):
Replying to [comment:35 ryan]:
> Alternatively, always set the default timezone to UTC and remove the
default timezone set in wp_timezone_override_offset(). Then everything
behaves as before.
Before was broken. It's only by setting the correct default timezone that
I can get correct behavior.
Short version is that the default timezone should be set to the
timezone_string (if set) at the earliest possible moment. Anywhere in core
that is expecting the current GMT should be adjusted to use better
functions to get that time, instead of using time() calls. current_time()
is the obvious choice, it could be adjusted to behave appropriately.
And that's basically that.
Note that time() should always returns an absolute value of seconds in
GMT. It is supposed to be unaffected by timezone settings. The problem is
that sometimes we apply offset to it and sometimes not. We just need to
remember to apply the offset correctly.
What cases still exist that create incorrect results?
--
Ticket URL: <http://core.trac.wordpress.org/ticket/9588#comment:36>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list