code: private long parseDate(Date date, long defaultValue) // d666295
      {
          if (date == null)
          {
              return defaultValue;
          }
  
          long value = date.getTime();
  
          if (value > 0)
          {
              // Round up to the nearest second.
              long remainder = value % 1000;
              if (remainder != 0)
              {
                  // Protect against overflow.
                  long newValue = value - remainder + 1000;
                  value = newValue > 0 || value < 0 ? newValue : Long.MAX_VALUE;
              }
          }
  
          return value;
      }
docs: Parses the date to milliseconds and rounds up to the nearest second.
  
  @param date the date to parse
  @param defaultValue the default value if the date is null
  @return the rounded milliseconds