public function writeDuration(QtiDuration $duration)
    {
        try {
            $this->writeString($duration->__toString());
        } catch (BinaryStreamAccessException $e) {
            $msg = "An error occured while writing a duration.";
            throw new QtiBinaryStreamAccessException($msg, $this, QtiBinaryStreamAccessException::DURATION, $e);
        }
    }