diff --git a/Modelica/Utilities/Time.mo b/Modelica/Utilities/Time.mo index 23f611edc6..5d8dd52aef 100644 --- a/Modelica/Utilities/Time.mo +++ b/Modelica/Utilities/Time.mo @@ -1277,6 +1277,82 @@ String(d, format=\"%%days\") // Should give \"%days\", but gives \"1\" instead end normalize; + annotation (Documentation(info=" + +
++ ++Time.Duration(); +Time.Duration(days=0, hours=0, minutes=0, seconds=0, milliseconds=0); +Time.Duration(dt1, dt2); +Time.Duration(totalSeconds); ++
+ The operator record Duration is used for elapsed time. + This can be the time between given by DateTime records + (i.e. by subtracting them) or a manually specified duration. +
++ There are multiple constructors provided to create a Duration element. + See the examples below for details. +
+ +Here is a brief summary, what the Duration operator record is capable of:
+++")); end Duration; annotation ( Documentation(info="+import Modelica.Utilities.Time.Duration; + +// Create Duration records from direct input +Duration(); // create Duration record using default constructor, which is fromInput +Duration.'constructor'.fromInput(hours=10); // explicit call of constructor +Duration(days=1, seconds=100); // automatic selection of constructor fromInput + +// Create Duration records from two DateTimes +import Modelica.Utilities.Time.DateTime; +dt1 = DateTime.now(); +dt2 = DateTime.now(); +Duration.'constructor'.fromDateTimes(dt1, dt2); // explicit call of constructor +Duration(dt1, dt2); // automatic selection of constructor via data type +Duration(dt1=dt1, dt2=dt2); // automatic selection of constructor via names + +// Create Duration records manually using the elapsed seconds since the given epoch year +Duration.'constructor'.fromSeconds(1); // explicit call of constructor +Duration(totalSeconds=1.5); // automatic selection of constructor via name ++