+ qsort_safe(all_ids, count, sizeof(boot_id_t), boot_id_cmp);
+
+ /* numbers are one less, but we need an extra char for the sign */
+ w = DECIMAL_STR_WIDTH(count - 1) + 1;
+
+ for (id = all_ids, i = 0; id < all_ids + count; id++, i++) {
+ char a[FORMAT_TIMESTAMP_MAX], b[FORMAT_TIMESTAMP_MAX];
+
+ printf("% *i " SD_ID128_FORMAT_STR " %s—%s\n",
+ w, i - count + 1,
+ SD_ID128_FORMAT_VAL(id->id),
+ format_timestamp(a, sizeof(a), id->first),
+ format_timestamp(b, sizeof(b), id->last));
+ }
+
+ return 0;
+}
+
+static int get_relative_boot_id(sd_journal *j, sd_id128_t *boot_id, int relative) {
+ int r;
+ const void *data;
+ unsigned int count = 0;
+ size_t length, allocated = 0;
+ boot_id_t ref_boot_id = {SD_ID128_NULL}, *id;
+ _cleanup_free_ boot_id_t *all_ids = NULL;
+
+ assert(j);
+ assert(boot_id);
+