Timestamp: (0)Jan 1, 1970 00:00:00.000000000

177 views
Skip to first unread message

Ovidiu Adam

unread,
Jun 23, 2021, 2:28:58 PM6/23/21
to opendnp3

Hello,

 I am new DNP3 and this is my first project using opendnp3.  Beautiful code, and it is a pleasure to use its interfaces to integrate it into the host application.

 I have an Outstation app, implementing 3 Counters (Obj:22, Var:05), 3 Analog (Obj:32, Var:08), and 3 Binary Input (Obj:02, Var:02).  According to my reading of the specs, they should all report their values together with the time stamp.

 Wireshark shows the Binary Inputs report data as expected, but the Counters and Analogs report the correct values with the wrong time fixed to “Timestamp: (0)Jan  1, 1970 00:00:00.000000000”:

    [1 DNP 3.0 AL Fragment (123 bytes): #13(123)]

    Application Layer: (FIR, FIN, CON, UNS, Sequence 15, Unsolicited Response)

        Application Control: 0xff, First, Final, Confirm, Unsolicited(FIR, FIN, CON, UNS, Sequence 15)

        Function Code: Unsolicited Response (0x82)

        Internal Indications: 0x0000

        RESPONSE Data Objects

            Object(s): 32-Bit Counter Change Event with Time (Obj:22, Var:05) (0x1605), 2 points

                Qualifier Field, Prefix: 2-Octet Index Prefix, Range: 16-bit Single Field Quantity

                Number of Items: 2

                Point Number 0 (Quality: Online), Count: 33, Timestamp: (0)Jan  1, 1970 00:00:00.000000000

                Point Number 2 (Quality: Online), Count: 99, Timestamp: (0)Jan  1, 1970 00:00:00.000000000

            Object(s): 64-Bit Floating Point Change Event w/ Time (Obj:32, Var:08) (0x2008), 3 points

                Qualifier Field, Prefix: 2-Octet Index Prefix, Range: 16-bit Single Field Quantity

                Number of Items: 3

                Point Number 0 (Quality: Online), Value: 33, Timestamp: (0)Jan  1, 1970 00:00:00.000000000

                Point Number 1 (Quality: Online), Value: 66, Timestamp: (0)Jan  1, 1970 00:00:00.000000000

                Point Number 2 (Quality: Online), Value: 99, Timestamp: (0)Jan  1, 1970 00:00:00.000000000

            Object(s): Binary Input Change With Time (Obj:02, Var:02) (0x0202), 3 points

                Qualifier Field, Prefix: 2-Octet Index Prefix, Range: 16-bit Single Field Quantity

                Number of Items: 3

                Point Number 0 (Quality: Online), Value: 1, Timestamp: Jun 22, 2021 19:37:01.216000000

                Point Number 1 (Quality: Online), Value: 1, Timestamp: Jun 22, 2021 19:37:01.216000000

                Point Number 2 (Quality: Online), Value: 1, Timestamp: Jun 22, 2021 19:37:01.216000000

 

I use Opendnp3 v3.1.0.  

 Is there anything I am missing to get the correct timestamp?

 Thank you,

Ovidiu Adam


Ovidiu

unread,
Jun 23, 2021, 7:31:53 PM6/23/21
to opendnp3

Never mind,  I have figured it out.

 

Thanks,

Ovidiu

--
You received this message because you are subscribed to the Google Groups "opendnp3" group.
To unsubscribe from this group and stop receiving emails from it, send an email to automatak-dnp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/automatak-dnp3/ccad39a1-979a-46c0-81ca-59626d8bb292n%40googlegroups.com.

Adam Crain

unread,
Jun 23, 2021, 7:32:37 PM6/23/21
to opendnp3
I was just about to write back to you to look at the default variations. Was that the solution? Not all event variations carry a timestamp, and static data never carries a timestamp.

Adam

Sean Mackey

unread,
Nov 5, 2021, 10:45:40 AM11/5/21
to opendnp3
Ovidiu,
I am having the same behavior. What was your fix?

Sean Mackey

unread,
Nov 5, 2021, 3:55:25 PM11/5/21
to Ovidiu, opendnp3
Are you saying the timestamps don't come from the outstation to the master over this wire?


On Fri, Nov 5, 2021 at 10:28 AM Ovidiu <ovidi...@gmail.com> wrote:

Hi Sean,

 

The library does not provide the timestamps. The application needs to provide them together with the values posted to the master, by invoking the constructor with the DNPTime time parameter for the Counter, Analog, Binary, …  classes.  Those are all declared in cpp\lib\include\opendnp3\app\MeasurementTypes.h

Ovidiu

unread,
Nov 5, 2021, 4:36:46 PM11/5/21
to Sean Mackey, opendnp3

My original problem, which I understand you have just hit, is that a timestamp of “(0)Jan 1, 1970 00:00:00.000000000comes from the outstation to the master over this wire.

Ovidiu

unread,
Nov 5, 2021, 4:36:58 PM11/5/21
to Sean Mackey, opendnp3

Hi Sean,

 

The library does not provide the timestamps. The application needs to provide them together with the values posted to the master, by invoking the constructor with the DNPTime time parameter for the Counter, Analog, Binary, …  classes.  Those are all declared in cpp\lib\include\opendnp3\app\MeasurementTypes.h

 

Ovidiu

 

 

From: automat...@googlegroups.com [mailto:automat...@googlegroups.com] On Behalf Of Sean Mackey


Sent: Thursday, November 04, 2021 1:15 PM
To: opendnp3

Adam Crain

unread,
Nov 6, 2021, 11:07:06 AM11/6/21
to opendnp3
There are two things at play here:

1) You must provide a timestamp when loading values into the outstation. The library does not automatically do this b/c it wouldn't work in the case that timestamp are acquired from a downstream source.

2) You must ensure you've configured the points in question to use event variations that have a time as not all variations have one on the wire.

Adam

Sean Mackey

unread,
Nov 8, 2021, 11:57:19 AM11/8/21
to opendnp3
Thanks for the feedback Adam.

We are only in control of the master-station service; our client controls the outstation. They have said that the data is coming from them with timestamps; we will be verifying with Wireshark this week.

I am setup to receive unsolicited all point data following the example code; I haven't setup configuration explicitly. 
Can you point me to the configuration example to enable event variation timestamps?

Adam Crain

unread,
Nov 9, 2021, 11:20:53 AM11/9/21
to opendnp3
You can also turn the application layer decoding on to easily see which specific variations the outstation is sending, but Wireshark is a good idea too.

In the outstation API you can configure the default static and event variations on a point-by-point basis as shown in this example:


There are type specific enumerations for all of these variations.

Ovidiu

unread,
Nov 9, 2021, 12:50:25 PM11/9/21
to Adam Crain, opendnp3

Note that in Adam’s example the  AddUpdates(…)  function,  case ('c')  invokes  builder.Update(Counter(state.count), 0);

 

If that counter is configured to use  event variations that have a time,  then the outstation will put on the wire Timestamp: (0)Jan 1, 1970 00:00:00.000000000.

 

To have the correct timestamp on the wire, that invocation needs to be changed like:  builder.Update(Counter(state.count, Flags(0x01), app->Now()), 0);

 

Ovidiu

Reply all
Reply to author
Forward
0 new messages