Skip to content

Commit f00ad20

Browse files
committed
Fix timestamp rounding
1 parent be7ae58 commit f00ad20

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

src/AasxServerBlazor/Properties/launchSettings.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@
1010
},
1111
"AasxServerBlazor": {
1212
"commandName": "Project",
13-
"commandLineArgs": "--no-security --save-temp 30 --secret-string-api 1234 --aasx-in-memory 1000 --data-path \"/Development/ragu3\" --edit --external-blazor http://localhost:5001",
13+
"commandLineArgs": "--no-security --save-temp 30 --secret-string-api 1234 --aasx-in-memory 1000 --data-path \"\\\\wsl.localhost\\Ubuntu\\home\\oze\\events\\Event1\" --edit --external-blazor http://localhost:5001",
1414
"launchBrowser": true,
1515
"environmentVariables": {
1616
"ASPNETCORE_ENVIRONMENT": "Development",
1717
"AASREGISTRY": "",
1818
"IFRAMEPATH": "https://dpp40-2-v2.industrialdigitaltwin.org/dashboard/submodelViewV3.html",
19-
"Kestrel__Endpoints__Http__Url": ""
19+
"Kestrel__Endpoints__Http__Url": "",
20+
"EVENT2": "http://localhost:5002/submodels/aHR0cHM6Ly9pNGQuZGUvVC8zMjA5NTEwL3N1Ym1vZGVsL05hbWVwbGF0ZS9yZWNlaXZlcg/events/EventElement1"
2021
},
2122
"applicationUrl": "http://localhost:5001",
2223
"jsWebView2Debugging": true

src/AasxServerDB/Events.cs

+11-4
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ public static int collectSubmodelElements(List<ISubmodelElement> submodelElement
9090
{
9191
case "CREATE":
9292
timeStamp = sme.TimeStampCreate;
93-
if (sme.TimeStampCreate >= sme.TimeStampTree && (sme.TimeStampCreate - diffTime).TotalMilliseconds > 1)
93+
if ((sme.TimeStampCreate - sme.TimeStampTree).TotalMilliseconds >= 0
94+
&& (sme.TimeStampCreate - diffTime).TotalMilliseconds > 1)
9495
{
9596
copy = true;
9697
}
@@ -103,8 +104,13 @@ public static int collectSubmodelElements(List<ISubmodelElement> submodelElement
103104
}
104105
break;
105106
case "UPDATE":
106-
timeStamp = sme.TimeStampTree;
107-
if (diffTime > sme.TimeStampCreate && sme.TimeStampCreate < sme.TimeStampTree && (sme.TimeStampTree - diffTime).TotalMilliseconds > 1)
107+
timeStamp = sme.TimeStampTree;
108+
var a = (diffTime - sme.TimeStampCreate).TotalMilliseconds;
109+
var b = (sme.TimeStampTree - sme.TimeStampCreate).TotalMilliseconds;
110+
var c = (sme.TimeStampTree - diffTime).TotalMilliseconds;
111+
if ((diffTime - sme.TimeStampCreate).TotalMilliseconds >= -1
112+
&& (sme.TimeStampTree - sme.TimeStampCreate).TotalMilliseconds > 1
113+
&& (sme.TimeStampTree - diffTime).TotalMilliseconds > 1)
108114
{
109115
if (children != null && children.Count != 0)
110116
{
@@ -125,7 +131,8 @@ public static int collectSubmodelElements(List<ISubmodelElement> submodelElement
125131
break;
126132
case "DELETE":
127133
timeStamp = sme.TimeStampDelete;
128-
if (diffTime > sme.TimeStampCreate && (sme.TimeStampDelete - diffTime).TotalMilliseconds > 1)
134+
if ((diffTime - sme.TimeStampCreate).TotalMilliseconds >= 0
135+
&& (sme.TimeStampDelete - diffTime).TotalMilliseconds > 1)
129136
{
130137
delete = true;
131138
}

src/AasxServerStandardBib/SecurityClient.cs

+4
Original file line numberDiff line numberDiff line change
@@ -1958,6 +1958,10 @@ static void operation_get_put_events(Operation op, int envIndex, DateTime timeSt
19581958
c = eventData.changes.Value;
19591959
}
19601960
var e = Events.EventPayload.CollectPayload(c, 0, eventData.statusData, source, d, diffEntry, np);
1961+
foreach (var diff in diffEntry)
1962+
{
1963+
Console.WriteLine(diff);
1964+
}
19611965

19621966
Console.WriteLine("PUT Events: " + requestPath + "/" + d);
19631967

0 commit comments

Comments
 (0)