<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to How to get system time</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/02c4655a4d/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Runtime/thread/02c4655a4d/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Runtime/thread/02c4655a4d/</id><updated>2020-02-27T16:59:38.793000Z</updated><subtitle>Recent posts to How to get system time</subtitle><entry><title>How to get system time</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/02c4655a4d/?limit=25#c98c" rel="alternate"/><published>2020-02-27T16:59:38.793000Z</published><updated>2020-02-27T16:59:38.793000Z</updated><author><name>impius</name><uri>https://forge.codesys.com/u/impius/</uri></author><id>https://forge.codesys.com0782553dd56b459cfbf4545e9135156a4095821b</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi Edwin&lt;br/&gt;
Big thanks for the fast help and the working solution, perfect!&lt;/p&gt;
&lt;p&gt;Cheers&lt;br/&gt;
impius&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>How to get system time</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/02c4655a4d/?limit=25#7494" rel="alternate"/><published>2020-02-27T16:59:37.816000Z</published><updated>2020-02-27T16:59:37.816000Z</updated><author><name>eschwellinger</name><uri>https://forge.codesys.com/u/eschwellinger/</uri></author><id>https://forge.codesys.com150e344e4ed0d3e93270d48030e9683c50dce360</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;use attached example,&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c"&gt;(* get time in seconds since 1970 *)&lt;/span&gt;
&lt;span class="n"&gt;udiUtcTime&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;SysTimeRtcGet&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;udiResult&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;IF&lt;/span&gt; &lt;span class="n"&gt;udiResult&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="n"&gt;THEN&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="n"&gt;RETURN&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;END_IF&lt;/span&gt;
&lt;span class="c"&gt;(*converts the utc time (seconds) to a SYSTIMEDATE with year, month , day, and time etc. *)&lt;/span&gt;
&lt;span class="n"&gt;udiResult&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;SysTimeRtcConvertUtcToDate&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;udiUtcTime&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;strTimeDate&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;IF&lt;/span&gt; &lt;span class="n"&gt;udiResult&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="n"&gt;THEN&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="n"&gt;RETURN&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;END_IF&lt;/span&gt;
&lt;span class="c"&gt;(*converts the utc time to the local time, regarding timezone and summer time in seconds *)&lt;/span&gt;
&lt;span class="n"&gt;udiResult&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;SysTimeRtcConvertUtcToLocal&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;udiUtcTime&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;udiUtcTimeLocal&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;IF&lt;/span&gt; &lt;span class="n"&gt;udiResult&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="n"&gt;THEN&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="n"&gt;RETURN&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;END_IF&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;The projectarchive is using the calendar from the oscat libraries too!&lt;/p&gt;
&lt;p&gt;BR&lt;br/&gt;
Edwin&lt;/p&gt;
&lt;p&gt;&lt;a class="" href="https://forum.codesys.com//download/file.php?id=946" rel="nofollow"&gt;TimerExample.project &lt;span&gt;&lt;span&gt;[148.72 KiB]&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>How to get system time</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/02c4655a4d/?limit=25#4e11" rel="alternate"/><published>2020-02-27T16:59:36.872000Z</published><updated>2020-02-27T16:59:36.872000Z</updated><author><name>impius</name><uri>https://forge.codesys.com/u/impius/</uri></author><id>https://forge.codesys.comc2dac4165fb3ab316d72e5ab1b503b458c4befef</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi all&lt;br/&gt;
Does anyone know how to read the system time from rasbian to use in CoDeSys? &lt;br/&gt;
The Raspberry is set up for ntp, and i would like to use that for a project where i need actual time and date without the need to readjust the clock after a power off.&lt;br/&gt;
Probably there is already a function somewhere and i just have not found it&lt;br/&gt;
Helpful could also be the possibility to run a pyton/php (or any other language) script on rasbian by codesys code and read in the result...&lt;/p&gt;
&lt;p&gt;Thanks for help, i work for years with codesys, but our controllers have RTC and we don't do the integration by our self &lt;/p&gt;&lt;/div&gt;</summary></entry></feed>