From: ara.t.howard@... Date: 2006-09-06T07:43:44+09:00 Subject: Re: representing a span of time On Wed, 6 Sep 2006, Brad Tilley wrote: > Berger, Daniel wrote: >>> x = 64299600.0 >>> Brad >> Are these values seconds since epoch? If so: >> >> irb(main):002:0> Time.at(1157489583.2798 - 64299600.0) >> => Sun Aug 22 09:53:03 MDT 2004 > > They are dates in time from Time.mktime(1972, 1, 15, 0, 0, 0) and > Time.now() represented as floats. Basically, I would like to show the > difference in a human significant way (years, months, days, etc.) > They are dates in time from Time.mktime(1972, 1, 15, 0, 0, 0) and > Time.now() represented as floats. Basically, I would like to show the harp:~ > cat a.rb require 'rubygems' require 'timeunits' a = Time.mktime(1972, 1, 15, 0, 0, 0).utc b = Time.now.utc delta = b - a puts delta.decades puts delta.years puts delta.months puts delta.days puts delta.minutes puts delta.seconds harp:~ > ruby a.rb 3.76567099435856 37.6567099435856 451.880519323027 12652.6545410448 18219822.5391045 1093189352.34627 -a -- what science finds to be nonexistent, we must accept as nonexistent; but what science merely does not find is a completely different matter... it is quite clear that there are many, many mysterious things. - h.h. the 14th dalai lama