<?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>Zephyr Timing With Epoch</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/103032/zephyr-timing-with-epoch</link><description>Hello, 
 
 I am using Zephyr in conjunction with a Xiao BLE Sense, my requirement is that I need the device to know when a certain date has been reached, is that possible with zephyr? I have tried using the time.h as in the documentation Zephyr said that</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 23 Aug 2023 16:49:07 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/103032/zephyr-timing-with-epoch" /><item><title>RE: Zephyr Timing With Epoch</title><link>https://devzone.nordicsemi.com/thread/442831?ContentTypeID=1</link><pubDate>Wed, 23 Aug 2023 16:49:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c75038e6-7940-4a4d-890b-19a28cc45a00</guid><dc:creator>wellmacj</dc:creator><description>&lt;p&gt;Im currently using zephyr with a dev container, I dont know if that encompasses the SDK for nordic? I am also using the expansion board with the Xiao, which has an RTC on it, would that work?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://wiki.seeedstudio.com/Seeeduino-XIAO-Expansion-Board/"&gt;wiki.seeedstudio.com/.../&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr Timing With Epoch</title><link>https://devzone.nordicsemi.com/thread/442387?ContentTypeID=1</link><pubDate>Mon, 21 Aug 2023 20:19:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d6a8c5e2-79cc-496c-a196-26968e15ac03</guid><dc:creator>tedhavelka</dc:creator><description>&lt;p&gt;Hello Cage,&lt;/p&gt;
&lt;p&gt;Regarding epoch time feature enabling in a Zephyr, about a year ago I observed some promising output from a Nordic Semi ncs v1.6.1 sample application, Nordic&amp;#39;s `aws_iot` sample app of that SDK release.&amp;nbsp; I was building and testing this sample on an nRF9160DK dev board.&amp;nbsp; I recall early on in the sample&amp;#39;s Zephyr console output -- which also streamed out some application messages -- that the firmware sample had connected with an Network Time Protocol (NTP) server.&amp;nbsp; Sample app then printed the date in a format much like or identical to Unix&amp;#39; default `date` utility output.&lt;/p&gt;
&lt;p&gt;Are you looking to add epoch time to your application without synchronizing with a time service somewhere on the internet?&amp;nbsp; If yes, then the NTP related part of Nordic&amp;#39;s `aws_iot` sample goes beyond what you need in that regard.&amp;nbsp; I see however looking over the included header files of aws_iot source file main.c, that the sample pulls in a Nordic header file named `date_time.h`, which in turn pulls in `time.h`.&lt;/p&gt;
&lt;p&gt;You mention that you ran into a undefined symbol error reported in `time.h`.&amp;nbsp; Can you share that error?&amp;nbsp; That might shed some light on an issue you&amp;#39;ll need to resolve whether you require NTP in addition to epoch time features from a given library.&lt;/p&gt;
&lt;p&gt;Two more things I will mention which you may already be aware:&amp;nbsp; (1) ncs v1.6.1 is quite old now, and only available from Nordic Semi github repository as a zip file:&lt;/p&gt;
&lt;p&gt;*&amp;nbsp; &lt;a id="" href="https://github.com/nrfconnect/sdk-nrf/releases/tag/v1.6.1"&gt;https://github.com/nrfconnect/sdk-nrf/releases/tag/v1.6.1&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you&amp;#39;re able to download ncs v1.6.1 and open `nrf/samples/nrf9160/aws_iot/src/main.c`, take a look for the function `static void date_time_event_handler(const struct date_time_evt *evt)`.&amp;nbsp; Those lines of code are the ones which I first found related to NTP service provision, which was related to the support of epoch time in this sample.&lt;/p&gt;
&lt;p&gt;(2)&amp;nbsp; I checked the latest ncs release and specifically this sample app, and there&amp;#39;s no longer any obvious NTP code in it.&amp;nbsp; Here is the path / URL to today&amp;#39;s cutting edge version of Nordic ncs and that sample app:&lt;/p&gt;
&lt;p&gt;*&amp;nbsp; &lt;a id="" href="https://github.com/nrfconnect/sdk-nrf/tree/main/samples/net/aws_iot"&gt;https://github.com/nrfconnect/sdk-nrf/tree/main/samples/net/aws_iot&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;You don&amp;#39;t mention which ncs version with which you&amp;#39;re working, so you may yet have NTP code in one or more Nordic sample apps.&amp;nbsp; That will be up to you to check whether you can find any `NTP` or `ntp` patterns among the sources in your local copy of their SDK.&lt;/p&gt;
&lt;p&gt;What was clear to me from the 1.6.1 version of aws_iot sample is that both epoch time and NTP service worked.&amp;nbsp; I was not even looking for those at that early stage development time.&amp;nbsp; But time feature and time synchronization are important and basic building blocks for many devices.&amp;nbsp; So I made a mental note of the working resource.&lt;/p&gt;
&lt;p&gt;Hopefully this can give you a place to look for how epoch time can be enabled in a Zephyr project.&amp;nbsp; There are likely examples outside of ncs altogether, but I haven&amp;#39;t looked elsewhere, and you&amp;#39;re using that SDK as well so it&amp;#39; a good starting point.&lt;/p&gt;
&lt;p&gt;- Ted&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>