Skip to content
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

Closed
mattias-lundell opened this issue Jul 6, 2013 · 14 comments
Closed

Why was "Duration" support removed? #77

mattias-lundell opened this issue Jul 6, 2013 · 14 comments

Comments

@mattias-lundell
Copy link

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.

@michaelklishin
Copy link
Member

Can you be more specific?

@mattias-lundell
Copy link
Author

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".

@michaelklishin
Copy link
Member

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.

@seancorfield
Copy link
Member

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?

@mattias-lundell
Copy link
Author

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.

@seancorfield
Copy link
Member

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.

@mattias-lundell
Copy link
Author

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.

@foobar27
Copy link

foobar27 commented Sep 8, 2013

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).
Also, when I configure my services with periods, I cannot even get the milliseconds out of those periods, because they depend on the current time.

@ghost
Copy link

ghost commented Sep 12, 2013

Durations also seem to be required if you want to pretty print durations (in the intuitive english sense).
I am currently using it when logging how long scripts take to run as well as for in-house accounting stuff.
So having it conveniently in the library instead of interop would be nice.

@foobar27
Copy link

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.

@michaelklishin
Copy link
Member

clj-time.duration for these new functions sounds like a good idea.

@seancorfield
Copy link
Member

Still open to PRs to restore this functionality in clj-time.duration...

@mattias-lundell
Copy link
Author

I think I have started somewhere already. I will wrap it up in a PR.

@seancorfield
Copy link
Member

Closing this In favor of a potential future PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants