<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[UNIX timestamp 2 hours out of sync]]></title><description><![CDATA[<p dir="auto">Hi There</p>
<p dir="auto">I have been struggling with the UNIX timestamp conversion a while now.  I finally got it working but now for whatever reason the time stamp DCI value netxms pulls is 2 hours behind exactly.</p>
<p dir="auto">I did a online converter of the timestamp as well and i get the same results.</p>
<p dir="auto">More info:<br />
I poll dci value using File.Time.Modify parameter.  I then use a script to convert from UNIX time. However, DCI value being polled is 2 hours behind the actual value.</p>
<p dir="auto">Please assist.</p>
<p dir="auto">Regards</p>
]]></description><link>https://forum.netxms.org/topic/4237/unix-timestamp-2-hours-out-of-sync</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 19:26:10 GMT</lastBuildDate><atom:link href="https://forum.netxms.org/topic/4237.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 19 Jan 2016 08:19:31 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to UNIX timestamp 2 hours out of sync on Tue, 19 Jan 2016 12:36:15 GMT]]></title><description><![CDATA[<p dir="auto">Thanx for the speedy reply.</p>
<p dir="auto">I actually found what my issue was. i was using the gmtime function and just changed to localtime and it works 100% now <img src="https://forum.netxms.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=72b86a538fc" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:1.4em;width:auto;vertical-align:middle" title=":)" alt="🙂" /></p>
<p dir="auto">I used basics here but nonetheless it works  <img src="https://forum.netxms.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f604.png?v=72b86a538fc" class="not-responsive emoji emoji-android emoji--smile" style="height:1.4em;width:auto;vertical-align:middle" title=":D" alt="😄" /></p>
<pre><code>day = localtime($1)-&gt;mday;

mon = localtime($1)-&gt;mon+1;

year = localtime($1)-&gt;year;

hour = localtime($1)-&gt;hour;

min = localtime($1)-&gt;min;

return day."-".mon."-".year."/".hour.":".min;
</code></pre>
<p dir="auto">I could have just added a variable t = ($1) to make it even easier.</p>
<p dir="auto">Thanx for the advice and putting me in the right direction.</p>
]]></description><link>https://forum.netxms.org/post/18895</link><guid isPermaLink="true">https://forum.netxms.org/post/18895</guid><dc:creator><![CDATA[duanebutler]]></dc:creator><pubDate>Tue, 19 Jan 2016 12:36:15 GMT</pubDate></item><item><title><![CDATA[Reply to UNIX timestamp 2 hours out of sync on Tue, 19 Jan 2016 11:09:53 GMT]]></title><description><![CDATA[<p dir="auto">How are you collecting the timestamp and how are you transforming it?<br />
It sounds like your transformation happends in UTC, whereas your timezone is +2.</p>
<p dir="auto">You can see how NXSL time-related functions work in this example script:</p>
<pre><code>// current time in Unix time
timeVar = time();

// lets convert to time object in UTC timezone
timeGM = gmtime(timeVar);

// lets convert to time object in our local timezone
timeLocal = localtime(timeVar);

// lets print all of them
// remember this is in UTC timezone
println(timeGM-&gt;year . "-" . 1 + timeGM-&gt;mon . "-" . timeGM-&gt;mday . " " . timeGM-&gt;hour . ":" . timeGM-&gt;min);
// this one will be in our local time, because we are using localtime() function
println(timeLocal-&gt;year . "-" . 1 + timeLocal-&gt;mon . "-" . timeLocal-&gt;mday . " " . timeLocal-&gt;hour . ":" . timeLocal-&gt;min);
// this one should be the same, since strftime() function works in localtime
println(strftime("%Y-%m-%d %H:%M - timezone %Z - offset from UTC - %z", timeVar));
</code></pre>
]]></description><link>https://forum.netxms.org/post/18893</link><guid isPermaLink="true">https://forum.netxms.org/post/18893</guid><dc:creator><![CDATA[tomaskir]]></dc:creator><pubDate>Tue, 19 Jan 2016 11:09:53 GMT</pubDate></item></channel></rss>