Fix optimization in getTimeRange

Change-Id: Ifa0753f0ad54c4fd75414071fc9c077c550da8c4
Reviewed-by: Niels Weber <niels.weber@digia.com>