/** * Returns: 1 on success, 0 on failure */ int atrans_get_nth_trans(ATrans *atrans, const char *from_frame, const char *to_frame, int nth_from_latest, BotTrans *btrans, int64_t *timestamp) { BotCTransLink *link = bot_ctrans_get_link(atrans->ctrans, from_frame, to_frame); if(!link) return 0; int status = bot_ctrans_link_get_nth_trans(link, nth_from_latest, btrans, timestamp); if(status && btrans && 0 != strcmp(to_frame, bot_ctrans_link_get_to_frame(link))) { bot_trans_invert(btrans); } return status; }
int bot_ctrans_path_latest_timestamp(const BotCTransPath * path, int64_t *timestamp) { int64_t result = 0; for(int lind=0; lind<path->nlinks; lind++) { BotCTransLink *link = path->links[lind]; int64_t link_timestamp; int have_trans = bot_ctrans_link_get_nth_trans(link, 0, NULL, &link_timestamp); if(!have_trans) { return 0; } if(0 == lind || link_timestamp > result) result = link_timestamp; } assert(timestamp); *timestamp = result; return 1; }