// Set time on new Calendar instance, and generate the GT string
Calendar calendar = Calendar.getInstance();
calendar.setTime( date );
GeneralizedTime gt = new GeneralizedTime( calendar );
assertEquals( "calendar time must equal the date time", date.getTime(), calendar.getTime().getTime() );
String gtStr = gt.toGeneralizedTime();
LOG.info( "generalized time string of original time = {}", gtStr );
// Parse and regenerate calendar from gtStr
GeneralizedTime recalculatedGt = new GeneralizedTime( gtStr );
long recalculatedTime = recalculatedGt.getCalendar().getTime().getTime();