date and time setting
Antwort
16.10.18 07:27

Hi comunity,

i try to use the Datalogger Demo. unfortunately i only get increasing time stamps in ms. is it possible to get date and time timestamps?

Another question - where can i set the clock of the device? when i check the csv files the change date is something like 31.01.2008 23:00:00

best regards

Franz

 

0 (0 Stimmen)
RE: date and time setting
Antwort
16.10.18 15:29 als Antwort auf Franz Krauter.
Hello Franz,

Welcome to the XDK community!

The XDK does not include a real time clock module, but there are two common ways to achive your goal. In both you should set the time once by calling the function clock_settime(clockid_t clock_id, const struct timespec *ts) .

The first way is to request the time from a SNTP server, which requires a Wi-Fi connection.
There has been a community thread , which even includes the user's source code. This could help regarding the Wi-Fi connection and the SNTP request.
If there is a Wi-Fi you can access to and you decide to solve this with the help of a SNTP server, feel free to ask for more information.

The second way to set the time is not that precise as the first one, but does not require a Wi-Fi connection and could be done offline.
In this way, you set the time manually by filling out the timespec ts by hand and passing it over to the clock_settime(clockid_t clock_id, const struct timespec *ts) function, which updates the time. By doing that, the .csv time values should change, too.

To receive the timestamps as local time, instead of the interval duration, you could change the timestamp feature by editing the definition of the GET_FATTIME() within the file ff.c to the earlier set local time.
Please keep in mind to create a backup copy of your original ff.c file, before you edit the library within the SDK. This change will affect all the XDK projects that use the SDK.

If you are new to the Bosch XDK, I recommend you the XDK knowledgebase , which offers great Bosch XDK articles for sensors, connectivity, protocols, data storage and ff.c much more. It offers even a Mita section, which can make coding with the XDK a lot easier.
You can start after a free registration and a click at the button getting started .

Please let me know if this was helpful and feel free to ask if you have further questions.

Kind regards,
Franjo
0 (0 Stimmen)