{"id":2412,"date":"2017-04-13T21:06:32","date_gmt":"2017-04-13T21:06:32","guid":{"rendered":"http:\/\/grodansparadis.com\/wordpress\/?p=2412"},"modified":"2017-04-13T21:06:32","modified_gmt":"2017-04-13T21:06:32","slug":"important-change-to-the-vscpeventvscpeventex-structures-and-timestamp-vscp","status":"publish","type":"post","link":"https:\/\/grodansparadis.com\/wordpress\/?p=2412","title":{"rendered":"Important change to the vscpEvent\/vscpEventEx structures  and timestamp #VSCP"},"content":{"rendered":"<h3><a href=\"https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2015\/08\/vscp_header.jpg\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1008\" data-permalink=\"https:\/\/grodansparadis.com\/wordpress\/?attachment_id=1008\" data-orig-file=\"https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2015\/08\/vscp_header.jpg?fit=586%2C199&amp;ssl=1\" data-orig-size=\"586,199\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"vscp_header\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2015\/08\/vscp_header.jpg?fit=580%2C197&amp;ssl=1\" class=\"alignnone size-full wp-image-1008\" src=\"https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2015\/08\/vscp_header.jpg?resize=580%2C197\" alt=\"\" width=\"580\" height=\"197\" srcset=\"https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2015\/08\/vscp_header.jpg?w=586&amp;ssl=1 586w, https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2015\/08\/vscp_header.jpg?resize=300%2C102&amp;ssl=1 300w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><\/h3>\n<h3>New fields in vscp event structures (vscp.h)<\/h3>\n<p>From version 1.12.20.0 a date\/time block of the following form<\/p>\n<blockquote>\n<pre>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ Time block - Always UTC time\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 uint16_t year; \r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 uint8_t month;\u00a0\u00a0 \u00a0\/\/ 1-12\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 uint8_t day;\u00a0\u00a0 \u00a0\u00a0 \/\/ 1-31\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 uint8_t hour;\u00a0\u00a0 \u00a0 \/\/ 0-23\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 uint8_t minute;\u00a0\u00a0 \/\/ 0-59\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 uint8_t second;\u00a0\u00a0 \/\/ 0-59<\/pre>\n<\/blockquote>\n<p>has been added to the <strong>vscpEvent<\/strong>\/<strong>vscpEventEx<\/strong> structures<\/p>\n<p>This will affect all interfaces that read and write VSCP events. So for the TCP\/IP interface which previously used<\/p>\n<pre class=\"code\">send head,class,type,obid,time-stamp,GUID,data1,data2,data3....<\/pre>\n<p>will now have the form<\/p>\n<pre class=\"code\">send head,class,type,obid,datetime,time-stamp,GUID,data1,data2,data3....<\/pre>\n<p>where datetime is the UTC date\/time in ISO standard form YYYY-MM-DDTHH:MM:SS<\/p>\n<p>It is possible to let the interface set this time to the current UTC time by leaving the item blank.<\/p>\n<p>So<\/p>\n<pre class=\"code\">send 0,20,3,0,,,-,0,1,35<\/pre>\n<p>will set the current UTC time (and timestamp) in the interface when the event is received.<\/p>\n<p>But on the other hand<\/p>\n<pre class=\"code\">send 0,20,3,0,\"2001-11_02T17:00:01\",,-,0,1,35<\/pre>\n<p>will use a specific date and time. Note that timestamp is set by the interface in this case.<\/p>\n<p>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.<\/p>\n<h3>timestamp<\/h3>\n<p>It&#8217;s a bit of\u00a0 confusion before if timestamp has been set in microseconds or milliseconds.\u00a0 Now this is definitely fixed at <strong>microseconds<\/strong>.\u00a0 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.<\/p>\n<p>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.\u00a0 Leave the field blank instead if you want the interface to set the timestamp.<\/p>\n<h3>Resend to the VSCP mailing list<\/h3>\n<p>I have previously resent blog entries here to the mailing list when I though they could be of interest for the mailing list audience.\u00a0 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.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>New fields in vscp event structures (vscp.h) From version 1.12.20.0 a date\/time block of the following form \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ Time block &#8211; Always UTC time \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 uint16_t year; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 uint8_t month;\u00a0\u00a0 \u00a0\/\/ 1-12 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 uint8_t day;\u00a0\u00a0 \u00a0\u00a0 \/\/ 1-31 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 uint8_t hour;\u00a0\u00a0 \u00a0 \/\/ 0-23 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 uint8_t minute;\u00a0\u00a0 \/\/ 0-59 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 uint8_t second;\u00a0\u00a0 \/\/ 0-59 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[54,13],"tags":[],"class_list":["post-2412","post","type-post","status-publish","format-standard","hentry","category-development","category-vscp"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p4raCZ-CU","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/grodansparadis.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/2412","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/grodansparadis.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/grodansparadis.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/grodansparadis.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/grodansparadis.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2412"}],"version-history":[{"count":1,"href":"https:\/\/grodansparadis.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/2412\/revisions"}],"predecessor-version":[{"id":2413,"href":"https:\/\/grodansparadis.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/2412\/revisions\/2413"}],"wp:attachment":[{"href":"https:\/\/grodansparadis.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2412"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/grodansparadis.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2412"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/grodansparadis.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2412"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}