code: private Double getDuration(Duration duration)
     {
        Double result;
        if (duration == null)
        {
           result = null;
        }
        else
        {
           if (duration.getUnits() != TimeUnit.HOURS)
           {
              duration = duration.convertUnits(TimeUnit.HOURS, m_projectFile.getProjectProperties());
           }
  
           result = Double.valueOf(duration.getDuration());
        }
        return result;
     }
docs: Retrieve a duration in the form required by Primavera.
  
  @param duration Duration instance
  @return formatted duration