[wp-trac] [WordPress Trac] #38773: Calculation error in human_time_diff

WordPress Trac noreply at wordpress.org
Sun Nov 13 10:27:42 UTC 2016


#38773: Calculation error in human_time_diff
--------------------------+-----------------------------
 Reporter:  SGr33n        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Date/Time     |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Hi,
 a few days ago I used human_time_diff() for the first time. It was in a
 wp-cron task manager, to check when the last run happened. Now the
 human_time_diff is rounded by php round, this means that if 2h and 1min
 ago it returns 2 hours ago, but if 2h, 30m and 1sec it returns 3 hours...
 and this is not true, because 3 hours haven't passed... and this also
 happens on 2 years and 1 hour (3 years?). So there is a patch to correct
 this, even if you want to correct it.

 Thanks :)

--
Ticket URL: <https://core.trac.wordpress.org/ticket/38773>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list