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 ; }
Parses the date to milliseconds and rounds up to the nearest second .