Using TIME to store duration is a bad idea?

17 views
Skip to first unread message

manu

unread,
Nov 18, 2012, 11:31:40 AM11/18/12
to datam...@googlegroups.com
Hey folks

One of my models has a "flight_time" property that I use to store how long - in hours and minutes of elapsed time - a flight took.

I defined it as a DataMapper 'Time' property since that's the closest match I could find...

As I use Postgresql, it basically translates that into a "timestamp without time zone" TYPE.

Only now I realise "how the hell am I going to manipulate this", e.g. adding the total flight time of the last 10 flights. manipulating psql timestamps can be quite mindboggling given what I'm trying to achieve.

Was this a Very Bad Idea? Should I have used two integer values e.g. elapsed_hrs and elapsed-minutes?

Thanks for your help.

manu

unread,
Nov 18, 2012, 11:39:56 AM11/18/12
to datam...@googlegroups.com
Oh and what I also wanted to ask is: is there a way to define a DM property that will generate a 'time' instead of 'timestamp' in a Postgresql db? Since DM Time = psql Timestamp, there doesn't seem to be an obvious way.
Reply all
Reply to author
Forward
0 new messages