# Re: Timers, scheduling and Ruby

**URL:** <https://www.ruby-forum.com/t/re-timers-scheduling-and-ruby/77949>\
**Category:** Ruby\
**Created:** [December 1, 2006, 9:23pm UTC](https://www.ruby-forum.com/t/re-timers-scheduling-and-ruby/77949 "2006-12-01T21:23:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![LipperS\_Matthew](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/8491ac/32.png) [@LipperS\_Matthew](https://www.ruby-forum.com/u/LipperS_Matthew)\
**Post date:** [December 1, 2006, 9:23pm UTC](https://www.ruby-forum.com/t/re-timers-scheduling-and-ruby/77949/1 "2006-12-01T21:23:34Z")

</div>

> here’s what i’d like
> 
> inclusive\_endpoint = Time.now + 7.days  
> ^^^^^^^^  
> is there already a library/utility for the above somewhere?

> ```
> # runt.next_times 
> inclusive_endpoint = now + sleep_interval
> 
> ```
> 
> make sense?  
> think so; will try to add this weekend. If I have questions may I  
> contact you offline? (I’m subscribed to CLR w/my work address – cc’d  
> address above is perfect!)

> thanks for a great lib btw!

np, thanks for the kind words! …anyway, Martin F. did all the hard  
work by coming up with the pattern in the first place…

Have a nice weekend all!

Matt

**mlipper\_\_at\_\_gmail\_dot\_com**

---

<div class="post-metadata">

**Author:** ![LipperS\_Matthew](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/8491ac/32.png) [@LipperS\_Matthew](https://www.ruby-forum.com/u/LipperS_Matthew)\
**Post date:** [December 1, 2006, 9:49pm UTC](https://www.ruby-forum.com/t/re-timers-scheduling-and-ruby/77949/2 "2006-12-01T21:49:40Z")

</div>

On Sat, 2 Dec 2006, Lipper, Matthew wrote:

> > inclusive\_endpoint = Time.now + 6.days  
> > ^^^^^^^^  
> > is there already a library/utility for the above somewhere?

written many times, but here’s mine:

class Numeric  
def microseconds() Float(self \* (10 \*\* -6)) end  
def milliseconds() Float(self \* (10 \*\* -3)) end  
def seconds() self end  
def minutes() 60 \* seconds end  
def hours() 60 \* minutes end  
def days() 24 \* hours end  
def weeks() 7 \* days end  
def months() 30 \* days end  
def years() 365 \* days end  
def decades() 10 \* years end

```
 %w[
   microseconds milliseconds seconds minutes hours days weeks months 

```

years decades  
].each{|m| alias\_method m.chop, m}  
end

you don’t have to write that part 😉

> > make sense?
> 
> think so; will try to add this weekend. If I have questions may I contact  
> you offline? (I’m subscribed to CLR w/my work address – cc’d address above  
> is perfect!)

absolutely.

> np, thanks for the kind words! …anyway, Martin F. did all the hard

i dunno about that - having transcribed quite a few books/articles into  
code  
myself - it’s hard wrapping your head around someone else’s ideas/code.

cheers.

-a
