<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Are SysTimeRtc* functions expected to be reentrant?</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/4dc79156b5/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/4dc79156b5/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/4dc79156b5/</id><updated>2022-11-04T19:20:23.800000Z</updated><subtitle>Recent posts to Are SysTimeRtc* functions expected to be reentrant?</subtitle><entry><title>Are SysTimeRtc* functions expected to be reentrant?</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/4dc79156b5/?limit=25#44cd/171a" rel="alternate"/><published>2022-11-04T19:20:23.800000Z</published><updated>2022-11-04T19:20:23.800000Z</updated><author><name>vics</name><uri>https://forge.codesys.com/u/vics/</uri></author><id>https://forge.codesys.com92de669a32b5c9b694e5b5d25c1f1cbe15ae6551</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;On any preemptive multitasking system you will still have a race condition unless the operation of getting the data is an atomic operation.  So you still end up with a need to address this race condition.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Are SysTimeRtc* functions expected to be reentrant?</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/4dc79156b5/?limit=250#44cd" rel="alternate"/><published>2022-11-04T18:36:07.514000Z</published><updated>2022-11-04T18:36:07.514000Z</updated><author><name>h-hermsen</name><uri>https://forge.codesys.com/u/hermsen/</uri></author><id>https://forge.codesys.comfcc709b74c58a4af9932e030938a413d09fc0c76</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;why not run this function only once in the most highest prio (or fastest) task and share the outcome via a global var.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Are SysTimeRtc* functions expected to be reentrant?</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/4dc79156b5/?limit=25#83a2/3483/bd28" rel="alternate"/><published>2022-11-02T15:39:13.264000Z</published><updated>2022-11-02T15:39:13.264000Z</updated><author><name>vics</name><uri>https://forge.codesys.com/u/vics/</uri></author><id>https://forge.codesys.comf8119482a65d01138c9379736ece5d9a7b472f0e</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;If I remember correctly, I wrapped the methods and put a giant lock/semaphore around the system calls.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Are SysTimeRtc* functions expected to be reentrant?</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/4dc79156b5/?limit=25#aef3" rel="alternate"/><published>2021-11-30T08:56:00.197000Z</published><updated>2021-11-30T08:56:00.197000Z</updated><author><name>FPawlak</name><uri>https://forge.codesys.com/u/fpawlak/</uri></author><id>https://forge.codesys.com4ac43ec4b01c2d4c9daf0db1f240671b8d9e720c</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi, I have very similar issue on Wago PFC200 (750-8212 and 750-8202).&lt;br/&gt;
I using directly only one thread. But I think that same 'internal processes' are also using this function. For example I've started to have 'access violation' when I added 'Trend recording' - it's working in another thread.&lt;br/&gt;
As workaround I can use Wago library, but it is not optimal/universal resolution. I always try to write 'vendor-independent' code as much as possible.&lt;br/&gt;
Maybe someone can check it on 'clear codesys' with codesys runtime.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Are SysTimeRtc* functions expected to be reentrant?</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/4dc79156b5/?limit=50#83a2/3483" rel="alternate"/><published>2021-06-01T07:38:35.526000Z</published><updated>2021-06-01T07:38:35.526000Z</updated><author><name>lennartt</name><uri>https://forge.codesys.com/u/lennartt/</uri></author><id>https://forge.codesys.comb4ae221fed2d0fc5a4ece4624ebd4446c6d54c49</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi Vic&lt;br/&gt;
seems like we are facing a similar problem using the SysTimeRtcGetTimezone function in multiple tasks, resulting in access violations. Did you solve it?&lt;br/&gt;
Thanks &lt;br/&gt;
Lennart&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Are SysTimeRtc* functions expected to be reentrant?</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/4dc79156b5/?limit=25#83a2" rel="alternate"/><published>2020-07-08T18:39:17.973000Z</published><updated>2020-07-08T18:39:17.973000Z</updated><author><name>vics</name><uri>https://forge.codesys.com/u/vics/</uri></author><id>https://forge.codesys.com9bbe3f86feb09a8d0d8c25337e9452ca63fc8c0a</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Good afternoon&lt;/p&gt;
&lt;p&gt;I have an application with several tasks that utilizes the SysTimeRtc* family of functions.  The initial problem I encountered was that the SysTimeRtcConvertHighResToLocal function would not properly convert the UTC time to local time.  The converted time that was being returned was always for the UTC time zone.  &lt;/p&gt;
&lt;p&gt;During the debugging process I discovered that the SysTimeRtcGetTimezone function was returning the timezone as UTC even though the PLC was properly configured with the appropriate time zone.&lt;/p&gt;
&lt;p&gt;Digging further, I narrowed the issue down to the runtime somehow getting corrupted when multiple tasks call the SysTimeRtc* functions concurrently.  Specifically, calling SysTimeRtcGetTimezone from multiple tasks causes the runtime to raise an AccessViolation exception.&lt;/p&gt;
&lt;p&gt;Once corrupted, the runtime needs to be restarted.  No issues with UTC to local timezone conversations are encountered with only one task using the functions.&lt;/p&gt;
&lt;p&gt;My question is whether or not the SysTimeRtc* functions are expected to be reentrant and if not is there documentation specifying which functions are or are not thread-safe.  &lt;/p&gt;
&lt;p&gt;Thanks&lt;br/&gt;
Vic&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>