- BT_LOGV("Getting notification's timestamp: "
- "muxer-notif-iter-addr=%p, notif-addr=%p, "
- "last-returned-ts=%" PRId64,
- muxer_notif_iter, notif, last_returned_ts_ns);
-
- switch (bt_notification_get_type(notif)) {
- case BT_NOTIFICATION_TYPE_EVENT:
- event = bt_notification_event_borrow_event(notif);
- BT_ASSERT(event);
- cv_status = bt_event_borrow_default_clock_value(event,
- &clock_value);
- break;
-
- case BT_NOTIFICATION_TYPE_INACTIVITY:
- clock_value =
- bt_notification_inactivity_borrow_default_clock_value(
- notif);
- break;
- default:
- /* All the other notifications have a higher priority */
- BT_LOGV_STR("Notification has no timestamp: using the last returned timestamp.");
- *ts_ns = last_returned_ts_ns;
- goto end;
- }
-
- if (cv_status != BT_CLOCK_VALUE_STATUS_KNOWN) {
- BT_LOGE_STR("Unsupported unknown clock value.");
- ret = -1;
- goto end;
- }
-
- /*
- * If the clock value is missing, then we consider that this
- * notification has no time. In this case it's always the
- * youngest.
- */
- if (!clock_value) {
- BT_LOGV_STR("Notification's default clock value is missing: "
- "using the last returned timestamp.");
- *ts_ns = last_returned_ts_ns;
- goto end;
- }
-
- clock_class = bt_clock_value_borrow_clock_class(clock_value);