[ 
https://issues.apache.org/jira/browse/OFBIZ-715?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12507532
 ] 

Adrian Crum commented on OFBIZ-715:
-----------------------------------

After scouring the 'net for some ideas, I discovered that the algorithms that 
produce the most accurate results utilize some looping like Andrew's 
implementation has. The main flaw with the implementation in the attached patch 
is the lack of "smarts" to prevent it from excessive looping. For instance, 
what if you requested elapsed milliseconds since 10 years ago?  The method in 
this patch would execute a loop for every millisecond in a ten year span.

I think I've come up with a good strategy for calculating elapsed time that 
combines some looping with additional logic. I'll work on it this weekend and 
then I will submit a patch.


> Utils for doing date calculations based on timeUomIds
> -----------------------------------------------------
>
>                 Key: OFBIZ-715
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-715
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: framework
>            Reporter: Andrew Sykes
>            Priority: Minor
>         Attachments: UtilDateTime.java.patch, UtilDateTime.java.patch
>
>
> 6 new methods, 
> 1/ adjustDateTime (3 methods) adjusts either a Timestamp Date or Calendar by 
> the given timeUomId and timeUomMultiple
> 2/ getTimeUomMultipleDifference (3 methods) gets the timeUomMultiple for two 
> Timestamp Date or Calendar objects given the timeUomId.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to