""" In my original posting, I said: "the periods table has id, date, start_time, end_time (and other fields)". I suppose I assumed that the presence of a 'date' field implied that the *_time fields were indeed of type time, but I'm sorry if that wasn't clear. """ my point was: my model implied datetime, your's not, don't blame web2py if my method don't work applied to your model.
so, there is an hiccup to your model: time fields don't represent a point in time, it has no sense trying to "subtract" them .... e.g. a record that has start time 09:00:00 and an end time of 10:00:00 means that it has passed one hour, one hour and one day or one hour and two days(and so on)? Anyway, if you do durations = db.periods.end_time - db.periods.start_time it works. but sqlite actually returns the difference in hours, and seems to round that as an integer.