code: public void setDuration (long millis)
      {
          // if we have only zero or one nodes, we don't have enough
          // information to compute our velocity
          int ncount = _nodes.size();
          if (ncount < 2) {
              log.warning("Requested to set duration of bogus path",
                  "path", this, "duration", millis);
              return;
          }
  
          // compute the total distance along our path
          float distance = 0;
          PathNode start = _nodes.get(0);
          for (int ii = 1; ii < ncount; ii++) {
              PathNode end = _nodes.get(ii);
              distance += MathUtil.distance(start.loc.x, start.loc.y, end.loc.x, end.loc.y);
              start = end;
          }
  
          // set the velocity accordingly
          setVelocity(distance/millis);
      }
docs: Computes the velocity at which the pathable will need to travel along this path such that
  it will arrive at the destination in approximately the specified number of milliseconds.
  Efforts are taken to get the pathable there as close to the desired time as possible, but
  framerate variation may prevent it from arriving exactly on time.