code: private Date calculateRegistrationTime(CalendarHashChain calendarHashChain) throws InvalidCalendarHashChainException {
          List<CalendarHashChainLink> chain = calendarHashChain.getChainLinks();
          long r = calendarHashChain.getPublicationTime().getTime() / 1000; // publication time in seconds
          long t = 0;
          // iterate over the chain in reverse
          ListIterator<CalendarHashChainLink> li = chain.listIterator(chain.size());
          while (li.hasPrevious()) {
              if (r <= 0) {
                  LOGGER.warn("Calendar hash chain shape is inconsistent with publication time");
                  r = 0;
                  return new Date(0);
              }
              CalendarHashChainLink link = li.previous();
  
              if (!link.isRightLink()) {
                  r = highBit(r) - 1;
              } else {
                  t = t + highBit(r);
                  r = r - highBit(r);
              }
          }
  
          if (r != 0) {
              LOGGER.warn("Calendar hash chain shape inconsistent with publication time");
              t = 0;
          }
  
          return new Date(t*1000);
      }
docs: Calculates the time when the signature was registered in the KSI hash calendar.