Skip to content

.Modelica.Utilities.System.getTime() returns bad year #3143

Closed
@adrpo

Description

@adrpo

Running this model:

model GetTime
  Integer ms;
  Integer sec;
  Integer min;
  Integer hour;
  Integer mon;
  Integer year;
algorithm
  (ms, sec, min, hour, mon, year) := .Modelica.Utilities.System.getTime();
  .Modelica.Utilities.Streams.print("ms:" + String(ms) + "\n");
  .Modelica.Utilities.Streams.print("sec:" + String(sec) + "\n");
  .Modelica.Utilities.Streams.print("min:" + String(min) + "\n");
  .Modelica.Utilities.Streams.print("hour:" + String(hour) + "\n");
  .Modelica.Utilities.Streams.print("mon:" + String(mon) + "\n");
  .Modelica.Utilities.Streams.print("year:" + String(year) + "\n");
end GetTime;

with OpenModelica on Windows will give you year=10 and on Linux will give you year=9.
With Dymola 2019 on Windows ill give you year=10.

The code for the external C is here:
https://github.com/modelica/ModelicaStandardLibrary/blob/master/Modelica/Resources/C-Sources/ModelicaInternal.c#L1264
I haven't looked in detail into it, maybe somebody can spot the problem.

Metadata

Metadata

Assignees

Labels

L: C-SourcesIssue addresses Modelica/Resources/C-SourcesV: 3.2.2Issue originates in MSL v3.2.2 (and is not present in earlier releases)bugCritical/severe issue

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions