code: public static final String printDurationMandatory(MSPDIWriter writer, Duration duration)
     {
        String result;
  
        if (duration == null)
        {
           // SF-329: null default required to keep Powerproject happy when importing MSPDI files
           result = "PT0H0M0S";
        }
        else
        {
           TimeUnit durationType = duration.getUnits();
  
           if (durationType == TimeUnit.HOURS || durationType == TimeUnit.ELAPSED_HOURS)
           {
              result = new XsdDuration(duration).toString();
           }
           else
           {
              duration = duration.convertUnits(TimeUnit.HOURS, writer.getProjectFile().getProjectProperties());
              result = new XsdDuration(duration).toString();
           }
        }
  
        return (result);
     }
docs: Print duration.
  
  Note that Microsoft's xsd:duration parser implementation does not
  appear to recognise durations other than those expressed in hours.
  We use the compatibility flag to determine whether the output
  is adjusted for the benefit of Microsoft Project.
  
  @param writer parent MSPDIWriter instance
  @param duration Duration value
  @return xsd:duration value