Added methods to calculate duration/time instant with a given granularity.