New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why was "Duration" support removed? #77
Comments
Can you be more specific? |
Absolutely, what I ment was that in commit 6376f0e "Durations" (http://joda-time.sourceforge.net/key_duration.html) was added but it were removed in commit 4493925. My question was related to the commit comment "Drop api support for Duration for now". |
Yeah, I'm afraid only the original maintainer knows the reason and it was 3 years ago. Adding those functions back would be a good thing to investigate. |
It looks like Duration support was dropped (three years ago!!) in favor of Interval. Is there any good reason to support Duration, compared to Interval? Pros / cons of the two types? |
As I understand it an interval has a fixed start and end instant. Durations (and Periods) instead represents the time between two instants. Pros - time arithmetic. |
Fair enough. clj-time does support Period so I guess the question then becomes, do folks need Duration as well as Period? I'm not de facto against restoring Duration support - I just want to get a better sense of what the library is missing without it, since it was taken out so long ago. |
The big difference is that Duration is in absolute numbers measured in milliseconds, but Period is related to an Instant and not measured in absolute numbers. For example, the length of a period measured in milliseconds of one month depends on which month that is used as base, but a Duration is always a fixed amount of milliseconds. |
I would also favor the reintroduction of Duration. My application has services which do specific tasks periodically.When it does a task every day, I expect them to occur every 24 hours (and not 23h or 25h depending on daylight saving & co). |
Durations also seem to be required if you want to pretty print durations (in the intuitive english sense). |
The only issue I see is to adjust the API, e.g. clj-time.core/seconds is a Period and not a Duration. Maybe we should just add a clj-time.duration namespace for these constants? I also haven't checked the computation functions, like plus and minus. They might need adjustments too. |
|
Still open to PRs to restore this functionality in |
I think I have started somewhere already. I will wrap it up in a PR. |
Closing this In favor of a potential future PR. |
Early in the beginning there was support for "Duration" but this was removed almost immediately. Any specific reason? Otherwise I propose that it should be added again.
The text was updated successfully, but these errors were encountered: