Merge pull request #2 from dhellmann/v2flatten

fix duration calculation
Try and protect from passing in the wrong arguments into the db api

Also get_resources() takes start/stop_timestamp not start/stop.
There might be a better way of doing this...
This function is getting ugly.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
Make the error reporting better for invalid fields

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>