def get_point_of_reference(unit, count, epoch=None):
 if (unit == 'seconds'):
  multiplier = 1
 elif (unit == 'minutes'):
  multiplier = 60
 elif (unit == 'hours'):
  multiplier = 3600
 elif (unit == 'days'):
  multiplier = (3600 * 24)
 elif (unit == 'weeks'):
  multiplier = ((3600 * 24) * 7)
 elif (unit == 'months'):
  multiplier = ((3600 * 24) * 30)
 elif (unit == 'years'):
  multiplier = ((3600 * 24) * 365)
 else:
  raise ValueError('Invalid unit: {0}.'.format(unit))
 if (not epoch):
  epoch = time.time()
 epoch = fix_epoch(epoch)
 return (epoch - (multiplier * count))

def get_point_of_reference ( unit , count , epoch = None ) : if ( unit == 'seconds' ) : multiplier = 1 elif ( unit == 'minutes' ) : multiplier = 60 elif ( unit == 'hours' ) : multiplier = 3600 elif ( unit == 'days' ) : multiplier = ( 3600 * 24 ) elif ( unit == 'weeks' ) : multiplier = ( ( 3600 * 24 ) * 7 ) elif ( unit == 'months' ) : multiplier = ( ( 3600 * 24 ) * 30 ) elif ( unit == 'years' ) : multiplier = ( ( 3600 * 24 ) * 365 ) else : raise ValueError ( 'Invalid unit: {0}.' . format ( unit ) ) if ( not epoch ) : epoch = time . time ( ) epoch = fix_epoch ( epoch ) return ( epoch - ( multiplier * count ) )
get a point-of-reference timestamp in epoch + milliseconds by deriving from a unit and a count .