Skip to:
Content

BuddyPress.org

Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#256 closed defect (bug) (duplicate)

Calculate time differences in GMT

Reported by: hudatoriq Owned by: hudatoriq
Milestone: Priority: major
Severity: Version: 1.0
Component: Keywords: time since gmt
Cc:

Description

The function bp_core_time_since() use the current time to compare older date to if parameter $newer_date is not specified. Currently it uses the time() function which returns the current time in server timezone. But the old date we want to calculate isn't always in the same timezone. It often create error results.

Solution:

Use the WP function current_time() instead to get the current time in GMT. All time that need to be calculated against current time using bp_core_time_since() will have to be in GMT as well.

Attachments (1)

time_since.diff (641 bytes) - added by hudatoriq 12 years ago.

Download all attachments as: .zip

Change History (7)

#1 @mgkimsal
12 years ago

I tried that change and it still didn't work for me. Changing the "0" in the 60*60*0 to my time zone (-5) worked.

#2 @mgkimsal
12 years ago

But then that screwed up all the times in the 'members' area. What the heck?

#3 @hudatoriq
12 years ago

@mgkimsal

I think I'm gonna close this ticket. I have posted a new one in #257

This ticket only solves part of the problem: the timezone that is considered as NOW when calculating time differences. The old time that is calculated should also be converted in GMT if you're using this patch.

It's also interfered with the WordPress bug. http://trac.wordpress.org/ticket/8662

Anyway, using the time server timezone is a bad idea. Most people don't care what timezone the server they're using is on.

I think we should push the patch http://trac.wordpress.org/ticket/8662 for immediate commit. I hope this will be merged in 2.7.1. For WPMU, I wish it could be committed before final 2.7 release. Is it possible to do that?

Andy, if you're seeing this, I hope you tell the other automattic guy that is responsible for WP core & WPMU.

#4 @hudatoriq
12 years ago

  • Resolution set to duplicate
  • Status changed from new to closed

#5 @hudatoriq
12 years ago

See the ticket #257

#6 @(none)
11 years ago

  • Milestone Core 1.0 deleted

Milestone Core 1.0 deleted

Note: See TracTickets for help on using tickets.