add a second version of group_by_time method