I asked a similar question on #jruby yesterday and got the answer that all times have a date/TZ component.
I'm developing a running log and need *only* hh:mm:ss (no TZ or date component) to store the time taken to run a particular distance. AIU, there is no clean solution and so using datetime and then masking date. Is there something better ? -Arun On Jul 14, 3:14 am, Colin Law <[email protected]> wrote: > 2009/7/14 Marnen Laibow-Koser <[email protected]>: > > > > > > > Hassan Schroeder wrote: > >> On Mon, Jul 13, 2009 at 9:00 PM, Marnen > >> Laibow-Koser<[email protected]> wrote: > > >>> I do understand that it might be useful to do > > >>> @hassan.set_alarm_clock(AbstractTime.new(:hour => 7, :minute => 0)) > > >> It might, but it isn't to me, and it *isn't the use case I described*. > > >> "What time do you typically get up?" How simple is that? > > >> Build me a survey form, collect the responses, calculate average, > >> mean, do whatever desired statistical analysis, on data in the range > >> of 00:00 to 23:59. > > > Yes, that would be a perfect candidate for AbstractTime...now I > > understand your use case! (Though to me, at least, it's nearly > > equivalent to the use case I described with the alarm.) > > >> But there is not *any* time zone info associated with that. Period. > >> It simply isn't part of the question. Utterly, totally, irrelevant. > > > In this use case, you are quite right about that. Thanks for the > > explanation. > > Many use cases for a TimeOfDay do imply or require a time zone, some > uses cases do not, but there are certainly many use cases for > TimeOfDay where the Date is irrelevant. It is the fact that a db Time > object maps to a DateTime in Rails and then we have to mess about > explicitly ignoring the Date part that is the key annoyance for me. > > Colin --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

