I know this is a Ruby question but I’m not on any Ruby mailing lists and it’s for a Rails project (so might come under select_time etc. ) I thought I’d try here.
A user can choose integer values from select drop down boxes to predict how long an event will take. Obvious values are secs (0-59), minutes (0-59) … weeks (0-4), months (0-11) …
These values are then converted to seconds and stored as decimal in the DB (I allow fractions of a second, too (tenth, hundredth, millisecond). when they are retrieved form the DB, I convert the seconds to a string format of, for example, 01:39:11 (from 5951 seconds). If fractions are used, they are just appended to the string. (non of this is elegant IMO)
That’s all done in my Converter class. I am going to write a Calculator class to compare all times entered for an event and picking the closest times to how long the actual event took.
So my question is, I know I can’t use a Time object but it would be really nice to know if there is something out there that could help me with this as to write my own Calculator is going to be a bit of a pain.
Also, by throwing this out there, somebody might say something that I haven’t thought of doing and could totally change the way I’m doing this.