Skip to content
This repository

Implement Durations #4

Closed
jmalloc opened this Issue · 3 comments

1 participant

James Harris
James Harris
Owner

The definitions here are appropriate:

  • interval - A span of time between two concrete points in the time-continuum.
  • duration - A measurement in seconds.
  • period - Duration defined in terms of individual components ("1 month, 3 days, 5 hours")

I'm not sure whether a duration is strictly necessary (we could just use a period and only use the seconds component), this requires further discussion.

James Harris
Owner

There's also the idea of a recurring period or duration with an interval, there should be an iterator for this... something like ...

$interval = new Year(2012);
$period = new Period('2 weeks');
$iterator = new PeriodIterator($interval, $period);

foreach ($iterator as $value)
{
    // $value would be an Interval containing each fortnightly chunk of the year 2012.
}
James Harris
Owner
jmalloc commented

Decided not to conflate Period and Duration instances, as you will always be able to get concrete seconds from a duration, but not necessarily a period.

James Harris jmalloc referenced this issue from a commit
James Harris jmalloc Added Duration class (#4) 4910a77
James Harris
Owner
jmalloc commented

Implementation of periods moved to #32.

James Harris jmalloc closed this in 3b5a424
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.