## FCSys.Utilities.Time

Functions to check translation time

### Information

Extends from Modelica.Icons.Package (Icon for standard packages).

### Package Content

Name | Description
--- | ---
get_time | Return the current time
timeTranslation | Print the time required to translate a model

## FCSys.Utilities.Time.get_time

Return the current time

### Information

Extends from Modelica.Icons.Function (Icon for functions).

### Outputs

Type | Name | Description
--- | --- | ---
Integer | t | Time in milliseconds since January 1, 1970

### Modelica definition

    function get_time "Return the current time"
      extends Modelica.Icons.Function;

      output Integer t "Time in milliseconds since January 1, 1970";

    external"C";
      // Note:  Since Dymola 7.4 doesn't support the IncludeDirectory annotation,
      // it will be necessary to use the full
      // path in the Include annotation, e.g.
      //   Include="#include \"FCSys/FCSys 2.0/Resources/Source/C/time.c\""

    end get_time;

## FCSys.Utilities.Time.timeTranslation

Print the time required to translate a model

### Information

The time is rounded down to the integer second.

Extends from Modelica.Icons.Function (Icon for functions).

### Inputs

Type | Name | Default | Description
--- | --- | --- | ---
String | problem |  | Path and name of the model (with modifiers, if any)
String | fileName | "translg.txt" | File where to print (empty string is the terminal)

### Outputs

Type | Name | Description
--- | --- | ---
Boolean | ok | `true` if successful

### Modelica definition

    function timeTranslation
      "Print the time required to translate a model"
      extends Modelica.Icons.Function;
      import Modelica.Utilities.Streams.print;

      input String problem "Path and name of the model (with modifiers, if any)";
      input String fileName="translg.txt"
        "File where to print (empty string is the terminal)";
      output Boolean ok "true if successful";

    protected
      Integer t_0 "Start time in seconds";

    algorithm
      if fileName <> "" then
        Modelica.Utilities.Files.remove(fileName);
      end if;

      t_0 := get_time();
      ok := translateModel(problem);
      print("Translation time: " + String(get_time() - t_0) + " s", fileName);

    end timeTranslation;