note 59530 added to function.fmod
| From: | cory at lavacube dot net | Date: | Fri, 09 Dec 2005 06:13:10 +0000 |
| Subject: | note 59530 added to function.fmod | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-99797@lists.php.net to get a copy of this message | ||
I don't believe that is correct.
Try this out using your patch:
<?php
echo duration( mktime(0, 0, 0, 1, 0, 2006)-time() );
?>
As of right now, this will read:
1 month, 22 days, 24 hours, 49 minutes, 15 seconds
Which is completely incorrect. Seeing as how it is the 9th of December.
The real real flaw here is how the 'year' and 'month' periods are calculated. As
most months vary in length...
Thank you very much SnakeEater251 for pointing this out.
The quickest way to get slightly more accurate results, is to use averages based on one
"true" year, which is 365.25 days.
Change the year and month to:
'year' => 31557600, // one 'true year' (365.25 days)
'month' => 2629800, // one 'true year' divided by 12 :-)
I will work on developing a true fix, for pin-point accuracy. ;-)
- Cory Christison
----
Manual Page -- http://www.php.net/manual/en/function.fmod.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+59530
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+59530&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+59530&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+59530&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+59530&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+59530&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+59530&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+59530&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+59530&report=yes
Search -- http://master.php.net/manage/user-notes.php