Categories
Development VSCP

Important change to the vscpEvent/vscpEventEx structures and timestamp #VSCP

New fields in vscp event structures (vscp.h)

From version 1.12.20.0 a date/time block of the following form

        // Time block - Always UTC time
        uint16_t year; 
        uint8_t month;    // 1-12
        uint8_t day;      // 1-31
        uint8_t hour;     // 0-23
        uint8_t minute;   // 0-59
        uint8_t second;   // 0-59

has been added to the vscpEvent/vscpEventEx structures

This will affect all interfaces that read and write VSCP events. So for the TCP/IP interface which previously used

send head,class,type,obid,time-stamp,GUID,data1,data2,data3....

will now have the form

send head,class,type,obid,datetime,time-stamp,GUID,data1,data2,data3....

where datetime is the UTC date/time in ISO standard form YYYY-MM-DDTHH:MM:SS

It is possible to let the interface set this time to the current UTC time by leaving the item blank.

So

send 0,20,3,0,,,-,0,1,35

will set the current UTC time (and timestamp) in the interface when the event is received.

But on the other hand

send 0,20,3,0,"2001-11_02T17:00:01",,-,0,1,35

will use a specific date and time. Note that timestamp is set by the interface in this case.

The change affect a lot of code. Expect some instability. The helper lib has been changed appropriately so if using it your code should be safe.

timestamp

It’s a bit of  confusion before if timestamp has been set in microseconds or milliseconds.  Now this is definitely fixed at microseconds.  An unsigned long is enough to keep track of about 71 minutes before it roll over. This was considered a bit low before the date/time structure was introduced but is more than enough now.

When timestamp previously was sent with a value of zero it was set to UTC microseconds of the interface. This is not the case anymore.  Leave the field blank instead if you want the interface to set the timestamp.

Resend to the VSCP mailing list

I have previously resent blog entries here to the mailing list when I though they could be of interest for the mailing list audience.  This will be the last one resent this way. If you are interested in blog posts about VSCP subscribe to this blog. An RSS reader is another option.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.