[PATCH RFC BlueZ 4/4] Time Server: use time zone and DST from system

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 time/server.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/time/server.c b/time/server.c
index 5079f35..1f624a6 100644
--- a/time/server.c
+++ b/time/server.c
@@ -88,8 +88,16 @@ static uint8_t local_time_info_read(struct attribute *a, gpointer user_data)
 
 	DBG("a=%p", a);
 
-	value[0] = 0xff; /* DST Offset (255: unknown) */
-	value[1] = 0x80; /* Time Zone (-128: unknown) */
+	tzset();
+
+	/* FIXME: POSIX "daylight" variable only indicates whether there is DST
+	 * for the local time or not. The offset is unknown. */
+	value[0] = daylight ? 0xff : 0x00;
+
+	/* Convert POSIX "timezone" (seconds West of GMT) to Time Profile
+	 * format (offset from UTC in number of 15 minutes increments). */
+	value[1] = (uint8_t) (-1 * timezone / (60 * 15));
+
 	attrib_db_update(a->handle, NULL, value, sizeof(value), NULL);
 
 	return 0;
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux