commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Work logged] (LANG-1407) Duration Utils - Rounding Duration
Date Wed, 13 Mar 2019 12:03:00 GMT

     [ https://issues.apache.org/jira/browse/LANG-1407?focusedWorklogId=212337&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-212337
]

ASF GitHub Bot logged work on LANG-1407:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 13/Mar/19 12:02
            Start Date: 13/Mar/19 12:02
    Worklog Time Spent: 10m 
      Work Description: chtompki commented on issue #406: [LANG-1407] DurationUtils - methods
for rounding duration 
URL: https://github.com/apache/commons-lang/pull/406#issuecomment-472394029
 
 
   I'm not even sure that "rounding" is what's going on here. Specifically:
   
   ```java
    //given
   Duration duration = Duration.of(2, ChronoUnit.DAYS).plusMillis(1);
   //when
   long roundedDays = DurationUtils.roundUpDays(duration);
   //then
   Assertions.assertEquals(3, roundedDays);
   ```
   
   looks a whole lot like a ceiling calculation. I'm I'm curious if there's literature or
existent examples out there in the wild about how to name this sort of functionality. I would
think we would want to follow what ever convention in place is already out there.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Issue Time Tracking
-------------------

            Worklog Id:     (was: 212337)
            Time Spent: 10m
    Remaining Estimate: 0h

> Duration Utils - Rounding Duration
> ----------------------------------
>
>                 Key: LANG-1407
>                 URL: https://issues.apache.org/jira/browse/LANG-1407
>             Project: Commons Lang
>          Issue Type: Task
>            Reporter: Aleksander Ściborek
>            Priority: Minor
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> In Java 8 Duration is always rounded down - for instance if we have LocalDates instances
with values 20:00 and 22:40, we will get 2 hours of duration between them. Purpose of this
util class is to provide an easy way to round up a duration in a given time unit. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message