diff options
Diffstat (limited to 'sdpd/service.c')
-rw-r--r-- | sdpd/service.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/sdpd/service.c b/sdpd/service.c index 002efc85..09459f43 100644 --- a/sdpd/service.c +++ b/sdpd/service.c @@ -31,6 +31,7 @@ #include <stdio.h> #include <errno.h> #include <stdlib.h> +#include <sys/time.h> #include <sys/socket.h> #include <bluetooth/bluetooth.h> @@ -61,6 +62,23 @@ static sdp_version_t sdpVnumArray[1] = { static const int sdpServerVnumEntries = 1; /* + * A simple function which returns the time of day in + * seconds. Used for updating the service db state + * attribute of the service record of the SDP server + */ +uint32_t sdp_get_time() +{ + /* + * To handle failure in gettimeofday, so an old + * value is returned and service does not fail + */ + static struct timeval tm; + + gettimeofday(&tm, NULL); + return (uint32_t) tm.tv_sec; +} + +/* * The service database state is an attribute of the service record * of the SDP server itself. This attribute is guaranteed to * change if any of the contents of the service repository |