anchor.diff:  
   def prune_tables(args):
       now = time.time()
  -    start_time = get_isotime(now)
  -    retain_time = get_isotime(now - (int(args.retain_days) * 60 * 60 * 24))
  +    run_time = get_isotime(now)
       tenants = get_tenant_list()
       admin_id = get_tenant_id(tenants, args.admin_tenant)
  -    print "Database pruning executing at %s" % start_time
  -    print "Keeping records later than %s" % retain_time
  +    print "Database pruning executing at %s" % run_time
       print "Admin project '%s' (%s)" % (args.admin_tenant, admin_id)
  +    if args.retain_days:
  +        retain_time = get_isotime(now - (int(args.retain_days) * 60 * 60 * 24))
  +        time_clause = "time_stamp < '%s'" % retain_time
  +        print "Keeping records more recent than %s" % retain_time
  +    else:
  +        print "Pruning records between %s and %s" % (args.start_time, args.end_time)
  +        time_clause = "time_stamp >= '%s' and time_stamp <= '%s'" % (args.start_time, args.end_time)
   
       delete_sql = """
          DELETE
          FROM MonMetrics.Measurements
  -       WHERE time_stamp < '%s'
  +       WHERE %s
          AND definition_dimensions_id IN (SELECT
            defdims.id
          FROM MonMetrics.Definitions def,
  
positive.code:                 "AND def.tenant_id != '%s' AND def.tenant_id IN (%s)" \
                  % (admin_id, limited_in_list)
  
          vsql(delete_sql % (retain_time, limit_clause))
  
      elif args.ignore:
  
  
negative.code:          where
      """
  
      first_time = True
      pairs = dimensions.split(',')
      for pair in pairs:
          kv = pair.split('=')
          if first_time:
              sql += " ( "
          else: 
              sql += " or "
          sql += " (name = '%s' and value = '%s')" % (kv[0], kv[1])
          first_time = False
  
      sql += ") group by dimension_set_id)"
      return sql
  
  
  