code: public static Date nextGivenSecondDate (final Date date, final int secondBase)
    {
      if (secondBase < 0 || secondBase > 59)
        throw new IllegalArgumentException ("secondBase must be >=0 and <= 59");
  
      final Calendar c = PDTFactory.createCalendar ();
      c.setTime (date != null ? date : new Date ());
      c.setLenient (true);
  
      if (secondBase == 0)
      {
        c.set (Calendar.MINUTE, c.get (Calendar.MINUTE) + 1);
        c.set (Calendar.SECOND, 0);
        c.set (Calendar.MILLISECOND, 0);
      }
      else
      {
        final int second = c.get (Calendar.SECOND);
        final int arItr = second / secondBase;
        final int nextSecondOccurance = secondBase * (arItr + 1);
        if (nextSecondOccurance < 60)
        {
          c.set (Calendar.SECOND, nextSecondOccurance);
          c.set (Calendar.MILLISECOND, 0);
        }
        else
        {
          c.set (Calendar.MINUTE, c.get (Calendar.MINUTE) + 1);
          c.set (Calendar.SECOND, 0);
          c.set (Calendar.MILLISECOND, 0);
        }
      }
      return c.getTime ();
    }
docs: <p>
  Returns a date that is rounded to the next even multiple of the given
  minute.
  </p>
  <p>
  The rules for calculating the second are the same as those for calculating
  the minute in the method <code>getNextGivenMinuteDate(..)</code>.
  </p>
  
  @param date
  the Date to round, if <code>null</code> the current time will be
  used
  @param secondBase
  the base-second to set the time on
  @return the new rounded date
  @see #nextGivenMinuteDate(Date, int)