code: public Duration getDurationVariance()
     {
        Duration variance = (Duration) getCachedValue(TaskField.DURATION_VARIANCE);
        if (variance == null)
        {
           Duration duration = getDuration();
           Duration baselineDuration = getBaselineDuration();
  
           if (duration != null && baselineDuration != null)
           {
              variance = Duration.getInstance(duration.getDuration() - baselineDuration.convertUnits(duration.getUnits(), getParentFile().getProjectProperties()).getDuration(), duration.getUnits());
              set(TaskField.DURATION_VARIANCE, variance);
           }
        }
        return (variance);
     }
docs: The Duration Variance field contains the difference between the
  baseline duration of a task and the total duration (current estimate)
  of a task.
  
  @return Duration