eclipse-sparkplug / sparkplug

Sparkplug
Eclipse Public License 2.0
109 stars 39 forks source link

Bug Report: [tck-id-payloads-timestamp-in-UTC] This timestamp MUST be in UTC] #452

Open sztibi82 opened 1 year ago

sztibi82 commented 1 year ago

What happened?

While testing our application with SparkplugB TCK I observed that our application fails this test. While debugging i found that public static boolean checkUTC(long timestamp, long UTCwindow) has a bug: else if (diff < 0) { // The timestamp is within the next allowed interval. // This shouldn't happen unless clocks differ between machines // but we should allow for it. result = diff >= UTCwindow; -< here this should be "-1*diff" or even better }

or an alternative: else if (diff > 0) { // The timestamp is within the previous allowed interval. result = diff <= UTCwindow; } else if (diff < 0) { // The timestamp is within the next allowed interval. // This shouldn't happen unless clocks differ between machines // but we should allow for it. result = diff >= UTCwindow; }

this could be replaced with else { result = Math.abs(diff) <= UTCwindow; }

What is the product or software this issue was discovered with?

Our own SparkplugB implementation testing.

What exact steps need to be performed to reproduce the problem?

Perform a SendData test for an Edge node

Is this related to a Sparkplug Listing request? If so, link the issue from https://github.com/eclipse-sparkplug/sparkplug.listings here.

no

Version

3.0.0 (Default)

Accept EFTL Terms

shouidar commented 7 months ago

Confirmed this bug, when diff is negative (diff >= UTCWindow) return false even if the abs value is within the window

bryce-nakatani commented 7 months ago

I think this is related to this issue https://github.com/eclipse-sparkplug/sparkplug/issues/471.

On Sat, Jan 27, 2024 at 8:57 AM shouidar @.***> wrote:

Confirmed this bug, when diff is negative (diff >= UTCWindow) return false even if the abs value is within the window

— Reply to this email directly, view it on GitHub https://github.com/eclipse-sparkplug/sparkplug/issues/452#issuecomment-1913259350, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEF6AZWUC4LWYZDM6YS6SFDYQUWZLAVCNFSM6AAAAAAXWZZBHOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJTGI2TSMZVGA . You are receiving this because you are subscribed to this thread.Message ID: @.***>