Lines Matching refs:ct_time

37 int bt_cts_time_to_unix_ms(const struct bt_cts_time_format *ct_time, int64_t *unix_ms)  in bt_cts_time_to_unix_ms()  argument
41 date_time.tm_year = sys_le16_to_cpu(ct_time->year); /* year (little endian) */ in bt_cts_time_to_unix_ms()
43 date_time.tm_mon = ct_time->mon - 1; /* month start from 1, but need from 0 */ in bt_cts_time_to_unix_ms()
44 date_time.tm_mday = ct_time->mday; /* day of month */ in bt_cts_time_to_unix_ms()
45 date_time.tm_hour = ct_time->hours; /* hours of day */ in bt_cts_time_to_unix_ms()
46 date_time.tm_min = ct_time->min; /* minute of hour */ in bt_cts_time_to_unix_ms()
47 date_time.tm_sec = ct_time->sec; /* seconds of minute */ in bt_cts_time_to_unix_ms()
48 date_time.tm_wday = ct_time->wday % 7; /* for sundays convert to 0, else keep same */ in bt_cts_time_to_unix_ms()
60 (*unix_ms) += ((ct_time->fractions256 * MSEC_PER_SEC) / BT_CTS_FRACTION_256_MAX_VALUE); in bt_cts_time_to_unix_ms()
65 int bt_cts_time_from_unix_ms(struct bt_cts_time_format *ct_time, int64_t unix_ms) in bt_cts_time_from_unix_ms() argument
74 ct_time->fractions256 = unix_ms; in bt_cts_time_from_unix_ms()
91 ct_time->year = sys_cpu_to_le16(date_time.tm_year); in bt_cts_time_from_unix_ms()
92 ct_time->mon = date_time.tm_mon + 1; /* months starting from 1 */ in bt_cts_time_from_unix_ms()
93 ct_time->mday = date_time.tm_mday; /* Day of month */ in bt_cts_time_from_unix_ms()
94 ct_time->hours = date_time.tm_hour; /* hours */ in bt_cts_time_from_unix_ms()
95 ct_time->min = date_time.tm_min; /* minutes */ in bt_cts_time_from_unix_ms()
96 ct_time->sec = date_time.tm_sec; /* seconds */ in bt_cts_time_from_unix_ms()
98 ct_time->wday = date_time.tm_wday; in bt_cts_time_from_unix_ms()
99 if (ct_time->wday == 0) { in bt_cts_time_from_unix_ms()
100 ct_time->wday = 7; /* sunday is represented as 7 */ in bt_cts_time_from_unix_ms()
122 struct bt_cts_time_format ct_time; in read_ct() local
124 err = cts_cb->fill_current_cts_time(&ct_time); in read_ct()
125 ct_time.reason = BT_CTS_UPDATE_REASON_UNKNOWN; in read_ct()
128 return bt_gatt_attr_read(conn, attr, buf, len, offset, &ct_time, sizeof(ct_time)); in read_ct()
138 struct bt_cts_time_format ct_time; in write_ct() local
144 if ((offset != 0) || (offset + len != sizeof(ct_time))) { in write_ct()
148 memcpy(&ct_time, buf, sizeof(ct_time)); in write_ct()
149 err = cts_cb->cts_time_write(&ct_time); in write_ct()
186 struct bt_cts_time_format ct_time; in bt_cts_send_notification() local
188 err = cts_cb->fill_current_cts_time(&ct_time); in bt_cts_send_notification()
189 ct_time.reason = reason; in bt_cts_send_notification()
193 return bt_gatt_notify(NULL, &cts_svc.attrs[1], &ct_time, sizeof(ct_time)); in bt_cts_send_notification()