<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Get UNIX Time with nrf9160</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/65455/get-unix-time-with-nrf9160</link><description>Hello, 
 I would like to get current UNIX time with my nrf9160. 
 First I saw that we can ask the current time from the modem using the AT cmd &amp;quot;AT+CCLK?&amp;quot;. 
 This function works, but give me the date and time and not the UNIX time. 
 I saw also that another</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 14 Apr 2022 23:17:05 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/65455/get-unix-time-with-nrf9160" /><item><title>RE: Get UNIX Time with nrf9160</title><link>https://devzone.nordicsemi.com/thread/363295?ContentTypeID=1</link><pubDate>Thu, 14 Apr 2022 23:17:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d33ffe0b-a857-46c8-aca3-3451d69b14f3</guid><dc:creator>Oli</dc:creator><description>&lt;p&gt;Got the same error. Is there another solution to getting the UNIX time in Zephyr? Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Get UNIX Time with nrf9160</title><link>https://devzone.nordicsemi.com/thread/271330?ContentTypeID=1</link><pubDate>Thu, 24 Sep 2020 12:08:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:97a7a726-8915-42e1-92ee-1b7568204886</guid><dc:creator>Elith</dc:creator><description>&lt;p&gt;Does not work in SDK/Zephyr 1.3.99.&lt;/p&gt;
&lt;p&gt;undefined reference to `date_time_update&amp;#39;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Get UNIX Time with nrf9160</title><link>https://devzone.nordicsemi.com/thread/267521?ContentTypeID=1</link><pubDate>Wed, 02 Sep 2020 05:54:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f9e604c0-5217-41bc-b76b-ce33806b9cc9</guid><dc:creator>thomas oggier</dc:creator><description>&lt;p&gt;Yes top it works fine&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Get UNIX Time with nrf9160</title><link>https://devzone.nordicsemi.com/thread/267485?ContentTypeID=1</link><pubDate>Tue, 01 Sep 2020 14:00:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4cac43b4-6e44-4654-b4f8-68d5e90e01e9</guid><dc:creator>Carl Richard</dc:creator><description>&lt;p&gt;Hello!&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Try to use the &lt;strong&gt;date_time&lt;/strong&gt; library instead (#include &amp;lt;date_time.h&amp;gt;). The current time can then be acquired using either the modem or NTP. A simple usage example below:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;#include &amp;lt;date_time.h&amp;gt;

/*TIME*/
s64_t unix_time_ms;

/*Force the date_time library to get current time */
date_time_update();

/*Read current time and put in container */
err = date_time_now(&amp;amp;unix_time_ms);

/*Print the current time */
printk(&amp;quot;Date_time: %i %i\n&amp;quot;, (u32_t)(unix_time_ms/1000000), (u32_t)(unix_time_ms%1000000));&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;If the program doesn&amp;#39;t compile, try to add the following line to prj.conf:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_LEGACY_TIMEOUT_API=y&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Hope this helps!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Carl Richard&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>