[wp-hackers] Possible bug in the function human_time_diff()

Chetan Kunte ckunte at gmail.com
Thu Mar 26 11:26:06 GMT 2009


> The function "get_the_time" will get the time for the current post.
> Are you putting this code in the correct place in the Loop?

Yes, I am. It is a simple loop. It displays post date followed by post
title. I have replaced the the_time() or the_date() call with echo
human_time_diff() . With the exception of the day it is published on,
it works fine for other days. On the day it is published, due to
perhaps time zones, it gets 'mungled', I think.

Here's what's happening:

Host server is in GMT -6.
I am publishing from GMT+1.

1 minute after publishing, it shows 5 hours ago, so appararently it is
doing this: abs(-6+1)= 5hrs ago.
1 hour later, it becomes, I think abs(-6+1+1)= 4hrs ago.
5 hours, 1min later, abs(-6+1+5)= 1min ago.
6 hours later, abs(-6+1+6)= 1 hour ago.
12 hours later abs(-6+1+12) = 7hours ago.

Does anyone else has seen this happening?
--
Chetan


More information about the wp-hackers mailing list