class PartitionSpec {

  protected String getFormattedTime(String input) {
    if (input == null || input.equals("")) {
      return null;
    }

    long ts;
    switch (this.interpreter) {
      case SECONDS:
        ts = (long) (Double.parseDouble(input) * 1000);
        break;
      case MILLISECONDS:
        ts = (long) (Double.parseDouble(input));
        break;
      default:
        throw new RuntimeException("Unknown interpreter");
    }

    /*
     * Sanity check
     */
    ts = Time.toMilliseconds(ts);

    /*
     * Round down
     */
    if (this.secondsToRound > 0) {
      ts = Math.round((double) ts / (this.secondsToRound * 1000)) * (this.secondsToRound * 1000);
    }

    return this.dateTimeFormatter.print(ts);
  }

  public  PartitionSpec();
  public  PartitionSpec(String name, List<String> sources, Interpreter interpreter, String format,
      int secondsToRound);
  public  PartitionSpec(String name, List<String> sources, Interpreter interpreter);
  public  PartitionSpec(String name, List<String> sources);
  public  PartitionSpec(String name, String... sources);

}