nRF Connect SDK API 0.1.0
Loading...
Searching...
No Matches

◆ bt_mesh_time_srv_mktime()

int64_t bt_mesh_time_srv_mktime ( struct bt_mesh_time_srv srv,
struct tm *  timeptr 
)

#include <include/bluetooth/mesh/time_srv.h>

Get the device uptime at a given local time.

Note
This function does not support lookups for local time that occurred before the TAI-time of the last received set- or status update. In addition, lookups for local time that happened before k_uptime_get must be used with caution, since there is no guarantee that the output data is fully reliable.
Whenever a zone or UTC change makes the local time jump forward in time, i.e. for day light savings adjustments, we get a situation where some points in time will occur twice on the local timeline. If the user where to input a local time that is affected by these changes the response uptime will reflect the input local time added with the new adjustment. Example: A time zone change is scheduled 12:00:00 a clock an arbitrary day to set the local clock forward by one hour. If the user requests the uptime for 12:00:05 at that same day, the returned uptime will be the same as if the user inputted the local time 13:00:05 of that day.
Whenever a zone or UTC change makes the local time jump backwards in time, i.e. for day light savings adjustments, we get a situation where some points in time never will on the local timeline. If the user where to input a local time that is affected by these changes the response uptime will reflect the local time instance that happens last. Example: A time zone change is scheduled 12:00:00 a clock an arbitrary day to set the local clock back one hour. If the user requests the uptime for 12:00:00 at that same day, the returned uptime will reflect the local time that under normal circumstances would be 13:00:00 that day.
Parameters
[in]srvTime Server instance.
[in]timeptrLocal time at the desired point.
Return values
Positiveuptime if successful, otherwise negative error value.