#209 new
Thomas Phipps

issues with time

Reported by Thomas Phipps | January 26th, 2009 @ 08:43 PM

recently, I came across a bug where the the 2 hours were being added to each feed. so if the feed was supposed to update every 15 min. it would update every 2 hours and 15min.

after a bit of bashing on the code i found the issue.

but first a little history about the problem. currently I run a server in las vegas, timezone -8 and the website is set for Arkansas time -6, well that explains the 2 hour difference if i could just find out where it was trying to use the pacific timezone. well the answer came from a query. to get the query to work right I changed $where .= " AND active = 1 AND (frequency + UNIX_TIMESTAMP(lastactive)) < ". (current_time('timestamp', true) + get_option('gmt_offset') * 3600) . " "; to $where .= " AND active = 1 AND (frequency + UNIX_TIMESTAMP(lastactive) - 28800 ) < ". (current_time('timestamp', true) - (-8 * 3600)) . " ";

yes I know this extremely hackish. but it was the only way I could get the numbers to match up with what is SUPPOSED to happen vs what was happening.

Comments and changes to this ticket

  • Thomas Phipps

    Thomas Phipps January 27th, 2009 @ 02:00 PM

    ok, further editing as that didn't really fix it.

    anyway i had to adjust the lastactive by the servers time zone. and adjust the current time by the websites time zone.

    wouldn't this be a lot easyer in the long run if you used the database for calculating time. and use php to adjust for timezone to display only. that way the only timezone math needed is for display. everything else is done in a single timezone no matter what settings are.

  • Ricardo Rauch

    Ricardo Rauch April 15th, 2010 @ 08:50 AM

    • Assigned user changed from “Guillermo Rauch” to “Ricardo Rauch”

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

WP-o-Matic project.

People watching this ticket

Pages