postgresql time handling (WIP)