mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-22 13:33:56 +03:00
tree-wide: use FORMAT_TIMESTAMP()
This commit is contained in:
parent
ae7c644c22
commit
04f5c018ce
@ -5963,8 +5963,6 @@ void exec_status_reset(ExecStatus *s) {
|
||||
}
|
||||
|
||||
void exec_status_dump(const ExecStatus *s, FILE *f, const char *prefix) {
|
||||
char buf[FORMAT_TIMESTAMP_MAX];
|
||||
|
||||
assert(s);
|
||||
assert(f);
|
||||
|
||||
@ -5980,14 +5978,14 @@ void exec_status_dump(const ExecStatus *s, FILE *f, const char *prefix) {
|
||||
if (dual_timestamp_is_set(&s->start_timestamp))
|
||||
fprintf(f,
|
||||
"%sStart Timestamp: %s\n",
|
||||
prefix, format_timestamp(buf, sizeof(buf), s->start_timestamp.realtime));
|
||||
prefix, FORMAT_TIMESTAMP(s->start_timestamp.realtime));
|
||||
|
||||
if (dual_timestamp_is_set(&s->exit_timestamp))
|
||||
fprintf(f,
|
||||
"%sExit Timestamp: %s\n"
|
||||
"%sExit Code: %s\n"
|
||||
"%sExit Status: %i\n",
|
||||
prefix, format_timestamp(buf, sizeof(buf), s->exit_timestamp.realtime),
|
||||
prefix, FORMAT_TIMESTAMP(s->exit_timestamp.realtime),
|
||||
prefix, sigchld_code_to_string(s->code),
|
||||
prefix, s->status);
|
||||
}
|
||||
|
@ -1616,12 +1616,9 @@ static void apply_clock_update(void) {
|
||||
|
||||
if (clock_settime(CLOCK_REALTIME, timespec_store(&ts, arg_clock_usec)) < 0)
|
||||
log_error_errno(errno, "Failed to set system clock to time specified on kernel command line: %m");
|
||||
else {
|
||||
char buf[FORMAT_TIMESTAMP_MAX];
|
||||
|
||||
else
|
||||
log_info("Set system clock to %s, as specified on the kernel command line.",
|
||||
format_timestamp(buf, sizeof(buf), arg_clock_usec));
|
||||
}
|
||||
FORMAT_TIMESTAMP(arg_clock_usec));
|
||||
}
|
||||
|
||||
static void cmdline_take_random_seed(void) {
|
||||
|
@ -38,13 +38,13 @@ void manager_dump(Manager *m, FILE *f, const char *prefix) {
|
||||
|
||||
for (ManagerTimestamp q = 0; q < _MANAGER_TIMESTAMP_MAX; q++) {
|
||||
const dual_timestamp *t = m->timestamps + q;
|
||||
char buf[CONST_MAX(FORMAT_TIMESPAN_MAX, FORMAT_TIMESTAMP_MAX)];
|
||||
char buf[FORMAT_TIMESPAN_MAX];
|
||||
|
||||
if (dual_timestamp_is_set(t))
|
||||
fprintf(f, "%sTimestamp %s: %s\n",
|
||||
strempty(prefix),
|
||||
manager_timestamp_to_string(q),
|
||||
timestamp_is_set(t->realtime) ? format_timestamp(buf, sizeof buf, t->realtime) :
|
||||
timestamp_is_set(t->realtime) ? FORMAT_TIMESTAMP(t->realtime) :
|
||||
format_timespan(buf, sizeof buf, t->monotonic, 1));
|
||||
}
|
||||
|
||||
|
@ -546,11 +546,9 @@ static void timer_enter_waiting(Timer *t, bool time_change) {
|
||||
}
|
||||
|
||||
if (found_realtime) {
|
||||
char buf[FORMAT_TIMESTAMP_MAX];
|
||||
|
||||
add_random(t, &t->next_elapse_realtime);
|
||||
|
||||
log_unit_debug(UNIT(t), "Realtime timer elapses at %s.", format_timestamp(buf, sizeof(buf), t->next_elapse_realtime));
|
||||
log_unit_debug(UNIT(t), "Realtime timer elapses at %s.", FORMAT_TIMESTAMP(t->next_elapse_realtime));
|
||||
|
||||
if (t->realtime_event_source) {
|
||||
r = sd_event_source_set_time(t->realtime_event_source, t->next_elapse_realtime);
|
||||
@ -664,12 +662,9 @@ static int timer_start(Unit *u) {
|
||||
ft = timespec_load(&st.st_mtim);
|
||||
if (ft < now(CLOCK_REALTIME))
|
||||
t->last_trigger.realtime = ft;
|
||||
else {
|
||||
char z[FORMAT_TIMESTAMP_MAX];
|
||||
|
||||
else
|
||||
log_unit_warning(u, "Not using persistent file timestamp %s as it is in the future.",
|
||||
format_timestamp(z, sizeof(z), ft));
|
||||
}
|
||||
FORMAT_TIMESTAMP(ft));
|
||||
|
||||
} else if (errno == ENOENT)
|
||||
/* The timer has never run before, make sure a stamp file exists. */
|
||||
|
@ -602,7 +602,7 @@ static void print_unit_dependency_mask(FILE *f, const char *kind, UnitDependency
|
||||
void unit_dump(Unit *u, FILE *f, const char *prefix) {
|
||||
char *t, **j;
|
||||
const char *prefix2;
|
||||
char timestamp[5][FORMAT_TIMESTAMP_MAX], timespan[FORMAT_TIMESPAN_MAX];
|
||||
char timespan[FORMAT_TIMESPAN_MAX];
|
||||
Unit *following;
|
||||
_cleanup_set_free_ Set *following_set = NULL;
|
||||
CGroupMask m;
|
||||
@ -640,11 +640,11 @@ void unit_dump(Unit *u, FILE *f, const char *prefix) {
|
||||
prefix, strna(u->instance),
|
||||
prefix, unit_load_state_to_string(u->load_state),
|
||||
prefix, unit_active_state_to_string(unit_active_state(u)),
|
||||
prefix, strna(format_timestamp(timestamp[0], sizeof(timestamp[0]), u->state_change_timestamp.realtime)),
|
||||
prefix, strna(format_timestamp(timestamp[1], sizeof(timestamp[1]), u->inactive_exit_timestamp.realtime)),
|
||||
prefix, strna(format_timestamp(timestamp[2], sizeof(timestamp[2]), u->active_enter_timestamp.realtime)),
|
||||
prefix, strna(format_timestamp(timestamp[3], sizeof(timestamp[3]), u->active_exit_timestamp.realtime)),
|
||||
prefix, strna(format_timestamp(timestamp[4], sizeof(timestamp[4]), u->inactive_enter_timestamp.realtime)),
|
||||
prefix, strna(FORMAT_TIMESTAMP(u->state_change_timestamp.realtime)),
|
||||
prefix, strna(FORMAT_TIMESTAMP(u->inactive_exit_timestamp.realtime)),
|
||||
prefix, strna(FORMAT_TIMESTAMP(u->active_enter_timestamp.realtime)),
|
||||
prefix, strna(FORMAT_TIMESTAMP(u->active_exit_timestamp.realtime)),
|
||||
prefix, strna(FORMAT_TIMESTAMP(u->inactive_enter_timestamp.realtime)),
|
||||
prefix, yes_no(unit_may_gc(u)),
|
||||
prefix, yes_no(unit_need_daemon_reload(u)),
|
||||
prefix, yes_no(u->transient),
|
||||
@ -756,14 +756,14 @@ void unit_dump(Unit *u, FILE *f, const char *prefix) {
|
||||
fprintf(f,
|
||||
"%s\tCondition Timestamp: %s\n"
|
||||
"%s\tCondition Result: %s\n",
|
||||
prefix, strna(format_timestamp(timestamp[0], sizeof(timestamp[0]), u->condition_timestamp.realtime)),
|
||||
prefix, strna(FORMAT_TIMESTAMP(u->condition_timestamp.realtime)),
|
||||
prefix, yes_no(u->condition_result));
|
||||
|
||||
if (dual_timestamp_is_set(&u->assert_timestamp))
|
||||
fprintf(f,
|
||||
"%s\tAssert Timestamp: %s\n"
|
||||
"%s\tAssert Result: %s\n",
|
||||
prefix, strna(format_timestamp(timestamp[0], sizeof(timestamp[0]), u->assert_timestamp.realtime)),
|
||||
prefix, strna(FORMAT_TIMESTAMP(u->assert_timestamp.realtime)),
|
||||
prefix, yes_no(u->assert_result));
|
||||
|
||||
for (UnitDependency d = 0; d < _UNIT_DEPENDENCY_MAX; d++) {
|
||||
|
@ -646,11 +646,11 @@ static int print_info(FILE *file, sd_journal *j, bool need_space) {
|
||||
|
||||
r = safe_atou64(timestamp, &u);
|
||||
if (r >= 0) {
|
||||
char absolute[FORMAT_TIMESTAMP_MAX], relative[FORMAT_TIMESPAN_MAX];
|
||||
char relative[FORMAT_TIMESPAN_MAX];
|
||||
|
||||
fprintf(file,
|
||||
" Timestamp: %s (%s)\n",
|
||||
format_timestamp(absolute, sizeof(absolute), u),
|
||||
FORMAT_TIMESTAMP(u),
|
||||
format_timestamp_relative(relative, sizeof(relative), u));
|
||||
|
||||
} else
|
||||
|
@ -31,7 +31,6 @@ static send_ra_t send_ra_function;
|
||||
|
||||
static void router_dump(sd_ndisc_router *rt) {
|
||||
struct in6_addr addr;
|
||||
char buf[FORMAT_TIMESTAMP_MAX];
|
||||
uint8_t hop_limit;
|
||||
uint64_t t, flags;
|
||||
uint32_t mtu;
|
||||
@ -45,7 +44,7 @@ static void router_dump(sd_ndisc_router *rt) {
|
||||
assert_se(sd_ndisc_router_get_address(rt, &addr) == -ENODATA);
|
||||
|
||||
assert_se(sd_ndisc_router_get_timestamp(rt, CLOCK_REALTIME, &t) >= 0);
|
||||
log_info("Timestamp: %s", format_timestamp(buf, sizeof(buf), t));
|
||||
log_info("Timestamp: %s", FORMAT_TIMESTAMP(t));
|
||||
|
||||
assert_se(sd_ndisc_router_get_timestamp(rt, CLOCK_MONOTONIC, &t) >= 0);
|
||||
log_info("Monotonic: %" PRIu64, t);
|
||||
|
@ -57,8 +57,6 @@ int main(int argc, char *argv[]) {
|
||||
JournalFile *f;
|
||||
const char *verification_key = argv[1];
|
||||
usec_t from = 0, to = 0, total = 0;
|
||||
char a[FORMAT_TIMESTAMP_MAX];
|
||||
char b[FORMAT_TIMESTAMP_MAX];
|
||||
char c[FORMAT_TIMESPAN_MAX];
|
||||
struct stat st;
|
||||
uint64_t p;
|
||||
@ -105,8 +103,8 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
if (verification_key && JOURNAL_HEADER_SEALED(f->header))
|
||||
log_info("=> Validated from %s to %s, %s missing",
|
||||
format_timestamp(a, sizeof(a), from),
|
||||
format_timestamp(b, sizeof(b), to),
|
||||
FORMAT_TIMESTAMP(from),
|
||||
FORMAT_TIMESTAMP(to),
|
||||
format_timespan(c, sizeof(c), total > to ? total - to : 0, 0));
|
||||
|
||||
(void) journal_file_close(f);
|
||||
|
@ -451,7 +451,6 @@ static int print_session_status_info(sd_bus *bus, const char *path, bool *new_li
|
||||
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
|
||||
_cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL;
|
||||
char since1[FORMAT_TIMESTAMP_RELATIVE_MAX];
|
||||
char since2[FORMAT_TIMESTAMP_MAX];
|
||||
const char *s1, *s2;
|
||||
SessionStatusInfo i = {};
|
||||
int r;
|
||||
@ -473,7 +472,7 @@ static int print_session_status_info(sd_bus *bus, const char *path, bool *new_li
|
||||
printf("%"PRIu32"\n", i.uid);
|
||||
|
||||
s1 = format_timestamp_relative(since1, sizeof(since1), i.timestamp.realtime);
|
||||
s2 = format_timestamp(since2, sizeof(since2), i.timestamp.realtime);
|
||||
s2 = FORMAT_TIMESTAMP(i.timestamp.realtime);
|
||||
|
||||
if (s1)
|
||||
printf("\t Since: %s; %s\n", s2, s1);
|
||||
@ -582,7 +581,6 @@ static int print_user_status_info(sd_bus *bus, const char *path, bool *new_line)
|
||||
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
|
||||
_cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL;
|
||||
char since1[FORMAT_TIMESTAMP_RELATIVE_MAX];
|
||||
char since2[FORMAT_TIMESTAMP_MAX];
|
||||
const char *s1, *s2;
|
||||
_cleanup_(user_status_info_clear) UserStatusInfo i = {};
|
||||
int r;
|
||||
@ -602,7 +600,7 @@ static int print_user_status_info(sd_bus *bus, const char *path, bool *new_line)
|
||||
printf("%"PRIu32"\n", i.uid);
|
||||
|
||||
s1 = format_timestamp_relative(since1, sizeof(since1), i.timestamp.realtime);
|
||||
s2 = format_timestamp(since2, sizeof(since2), i.timestamp.realtime);
|
||||
s2 = FORMAT_TIMESTAMP(i.timestamp.realtime);
|
||||
|
||||
if (s1)
|
||||
printf("\t Since: %s; %s\n", s2, s1);
|
||||
|
@ -58,7 +58,6 @@ bool logind_wall_tty_filter(const char *tty, void *userdata) {
|
||||
}
|
||||
|
||||
static int warn_wall(Manager *m, usec_t n) {
|
||||
char date[FORMAT_TIMESTAMP_MAX] = {};
|
||||
_cleanup_free_ char *l = NULL, *username = NULL;
|
||||
usec_t left;
|
||||
int r;
|
||||
@ -75,7 +74,7 @@ static int warn_wall(Manager *m, usec_t n) {
|
||||
isempty(m->wall_message) ? "" : "\n",
|
||||
m->scheduled_shutdown_type,
|
||||
left ? "at " : "NOW",
|
||||
left ? format_timestamp(date, sizeof(date), m->scheduled_shutdown_timeout) : "");
|
||||
left ? FORMAT_TIMESTAMP(m->scheduled_shutdown_timeout) : "");
|
||||
if (r < 0) {
|
||||
log_oom();
|
||||
return 0;
|
||||
|
@ -508,7 +508,6 @@ static void machine_status_info_clear(MachineStatusInfo *info) {
|
||||
|
||||
static void print_machine_status_info(sd_bus *bus, MachineStatusInfo *i) {
|
||||
char since1[FORMAT_TIMESTAMP_RELATIVE_MAX];
|
||||
char since2[FORMAT_TIMESTAMP_MAX];
|
||||
_cleanup_free_ char *addresses = NULL;
|
||||
const char *s1, *s2;
|
||||
int ifi = -1;
|
||||
@ -524,7 +523,7 @@ static void print_machine_status_info(sd_bus *bus, MachineStatusInfo *i) {
|
||||
putchar('\n');
|
||||
|
||||
s1 = format_timestamp_relative(since1, sizeof(since1), i->timestamp.realtime);
|
||||
s2 = format_timestamp(since2, sizeof(since2), i->timestamp.realtime);
|
||||
s2 = FORMAT_TIMESTAMP(i->timestamp.realtime);
|
||||
|
||||
if (s1)
|
||||
printf("\t Since: %s; %s\n", s2, s1);
|
||||
@ -829,7 +828,6 @@ typedef struct ImageStatusInfo {
|
||||
|
||||
static void print_image_status_info(sd_bus *bus, ImageStatusInfo *i) {
|
||||
char ts_relative[FORMAT_TIMESTAMP_RELATIVE_MAX];
|
||||
char ts_absolute[FORMAT_TIMESTAMP_MAX];
|
||||
char bs[FORMAT_BYTES_MAX];
|
||||
char bs_exclusive[FORMAT_BYTES_MAX];
|
||||
const char *s1, *s2, *s3, *s4;
|
||||
@ -860,14 +858,14 @@ static void print_image_status_info(sd_bus *bus, ImageStatusInfo *i) {
|
||||
i->read_only ? ansi_normal() : "");
|
||||
|
||||
s1 = format_timestamp_relative(ts_relative, sizeof(ts_relative), i->crtime);
|
||||
s2 = format_timestamp(ts_absolute, sizeof(ts_absolute), i->crtime);
|
||||
s2 = FORMAT_TIMESTAMP(i->crtime);
|
||||
if (s1 && s2)
|
||||
printf("\t Created: %s; %s\n", s2, s1);
|
||||
else if (s2)
|
||||
printf("\t Created: %s\n", s2);
|
||||
|
||||
s1 = format_timestamp_relative(ts_relative, sizeof(ts_relative), i->mtime);
|
||||
s2 = format_timestamp(ts_absolute, sizeof(ts_absolute), i->mtime);
|
||||
s2 = FORMAT_TIMESTAMP(i->mtime);
|
||||
if (s1 && s2)
|
||||
printf("\tModified: %s; %s\n", s2, s1);
|
||||
else if (s2)
|
||||
|
@ -105,14 +105,11 @@ static int bus_print_property(const char *name, const char *expected_value, sd_b
|
||||
* should it turn out to not be sufficient */
|
||||
|
||||
if (endswith(name, "Timestamp") ||
|
||||
STR_IN_SET(name, "NextElapseUSecRealtime", "LastTriggerUSec", "TimeUSec", "RTCTimeUSec")) {
|
||||
char timestamp[FORMAT_TIMESTAMP_MAX];
|
||||
const char *t;
|
||||
STR_IN_SET(name, "NextElapseUSecRealtime", "LastTriggerUSec", "TimeUSec", "RTCTimeUSec"))
|
||||
|
||||
t = format_timestamp(timestamp, sizeof(timestamp), u);
|
||||
bus_print_property_value(name, expected_value, flags, t);
|
||||
bus_print_property_value(name, expected_value, flags, FORMAT_TIMESTAMP(u));
|
||||
|
||||
} else if (strstr(name, "USec")) {
|
||||
else if (strstr(name, "USec")) {
|
||||
char timespan[FORMAT_TIMESPAN_MAX];
|
||||
|
||||
(void) format_timespan(timespan, sizeof(timespan), u, 0);
|
||||
|
@ -43,8 +43,7 @@ void user_record_show(UserRecord *hr, bool show_full_group_info) {
|
||||
printf(" Disposition: %s\n", user_disposition_to_string(user_record_disposition(hr)));
|
||||
|
||||
if (hr->last_change_usec != USEC_INFINITY) {
|
||||
char buf[FORMAT_TIMESTAMP_MAX];
|
||||
printf(" Last Change: %s\n", format_timestamp(buf, sizeof(buf), hr->last_change_usec));
|
||||
printf(" Last Change: %s\n", FORMAT_TIMESTAMP(hr->last_change_usec));
|
||||
|
||||
if (hr->last_change_usec > now(CLOCK_REALTIME))
|
||||
printf(" %sModification time lies in the future, system clock wrong?%s\n",
|
||||
@ -52,10 +51,8 @@ void user_record_show(UserRecord *hr, bool show_full_group_info) {
|
||||
}
|
||||
|
||||
if (hr->last_password_change_usec != USEC_INFINITY &&
|
||||
hr->last_password_change_usec != hr->last_change_usec) {
|
||||
char buf[FORMAT_TIMESTAMP_MAX];
|
||||
printf(" Last Passw.: %s\n", format_timestamp(buf, sizeof(buf), hr->last_password_change_usec));
|
||||
}
|
||||
hr->last_password_change_usec != hr->last_change_usec)
|
||||
printf(" Last Passw.: %s\n", FORMAT_TIMESTAMP(hr->last_password_change_usec));
|
||||
|
||||
r = user_record_test_blocked(hr);
|
||||
switch (r) {
|
||||
@ -238,15 +235,11 @@ void user_record_show(UserRecord *hr, bool show_full_group_info) {
|
||||
if (hr->locked >= 0)
|
||||
printf(" Locked: %s\n", yes_no(hr->locked));
|
||||
|
||||
if (hr->not_before_usec != UINT64_MAX) {
|
||||
char buf[FORMAT_TIMESTAMP_MAX];
|
||||
printf(" Not Before: %s\n", format_timestamp(buf, sizeof(buf), hr->not_before_usec));
|
||||
}
|
||||
if (hr->not_before_usec != UINT64_MAX)
|
||||
printf(" Not Before: %s\n", FORMAT_TIMESTAMP(hr->not_before_usec));
|
||||
|
||||
if (hr->not_after_usec != UINT64_MAX) {
|
||||
char buf[FORMAT_TIMESTAMP_MAX];
|
||||
printf(" Not After: %s\n", format_timestamp(buf, sizeof(buf), hr->not_after_usec));
|
||||
}
|
||||
if (hr->not_after_usec != UINT64_MAX)
|
||||
printf(" Not After: %s\n", FORMAT_TIMESTAMP(hr->not_after_usec));
|
||||
|
||||
if (hr->umask != MODE_INVALID)
|
||||
printf(" UMask: 0%03o\n", hr->umask);
|
||||
@ -401,18 +394,14 @@ void user_record_show(UserRecord *hr, bool show_full_group_info) {
|
||||
if (hr->good_authentication_counter != UINT64_MAX)
|
||||
printf(" Good Auth.: %" PRIu64 "\n", hr->good_authentication_counter);
|
||||
|
||||
if (hr->last_good_authentication_usec != UINT64_MAX) {
|
||||
char buf[FORMAT_TIMESTAMP_MAX];
|
||||
printf(" Last Good: %s\n", format_timestamp(buf, sizeof(buf), hr->last_good_authentication_usec));
|
||||
}
|
||||
if (hr->last_good_authentication_usec != UINT64_MAX)
|
||||
printf(" Last Good: %s\n", FORMAT_TIMESTAMP(hr->last_good_authentication_usec));
|
||||
|
||||
if (hr->bad_authentication_counter != UINT64_MAX)
|
||||
printf(" Bad Auth.: %" PRIu64 "\n", hr->bad_authentication_counter);
|
||||
|
||||
if (hr->last_bad_authentication_usec != UINT64_MAX) {
|
||||
char buf[FORMAT_TIMESTAMP_MAX];
|
||||
printf(" Last Bad: %s\n", format_timestamp(buf, sizeof(buf), hr->last_bad_authentication_usec));
|
||||
}
|
||||
if (hr->last_bad_authentication_usec != UINT64_MAX)
|
||||
printf(" Last Bad: %s\n", FORMAT_TIMESTAMP(hr->last_bad_authentication_usec));
|
||||
|
||||
t = user_record_ratelimit_next_try(hr);
|
||||
if (t != USEC_INFINITY) {
|
||||
@ -519,10 +508,8 @@ void group_record_show(GroupRecord *gr, bool show_full_user_info) {
|
||||
|
||||
printf(" Disposition: %s\n", user_disposition_to_string(group_record_disposition(gr)));
|
||||
|
||||
if (gr->last_change_usec != USEC_INFINITY) {
|
||||
char buf[FORMAT_TIMESTAMP_MAX];
|
||||
printf(" Last Change: %s\n", format_timestamp(buf, sizeof(buf), gr->last_change_usec));
|
||||
}
|
||||
if (gr->last_change_usec != USEC_INFINITY)
|
||||
printf(" Last Change: %s\n", FORMAT_TIMESTAMP(gr->last_change_usec));
|
||||
|
||||
if (gid_is_valid(gr->gid))
|
||||
printf(" GID: " GID_FMT "\n", gr->gid);
|
||||
|
@ -340,7 +340,6 @@ int utmp_wall(
|
||||
void *userdata) {
|
||||
|
||||
_cleanup_free_ char *text = NULL, *hn = NULL, *un = NULL, *stdin_tty = NULL;
|
||||
char date[FORMAT_TIMESTAMP_MAX];
|
||||
struct utmpx *u;
|
||||
int r;
|
||||
|
||||
@ -364,7 +363,7 @@ int utmp_wall(
|
||||
"%s\r\n\r\n",
|
||||
un ?: username, hn,
|
||||
origin_tty ? " on " : "", strempty(origin_tty),
|
||||
format_timestamp(date, sizeof(date), now(CLOCK_REALTIME)),
|
||||
FORMAT_TIMESTAMP(now(CLOCK_REALTIME)),
|
||||
message) < 0)
|
||||
return -ENOMEM;
|
||||
|
||||
|
@ -51,7 +51,7 @@ static int test_efi_loader(void) {
|
||||
}
|
||||
|
||||
static int test_boot_timestamps(void) {
|
||||
char s[MAX(FORMAT_TIMESPAN_MAX, FORMAT_TIMESTAMP_MAX)];
|
||||
char s[FORMAT_TIMESPAN_MAX];
|
||||
dual_timestamp fw, l, k;
|
||||
int r;
|
||||
|
||||
@ -67,9 +67,9 @@ static int test_boot_timestamps(void) {
|
||||
|
||||
log_info("Firmware began %s before kernel.", format_timespan(s, sizeof(s), fw.monotonic, 0));
|
||||
log_info("Loader began %s before kernel.", format_timespan(s, sizeof(s), l.monotonic, 0));
|
||||
log_info("Firmware began %s.", format_timestamp(s, sizeof(s), fw.realtime));
|
||||
log_info("Loader began %s.", format_timestamp(s, sizeof(s), l.realtime));
|
||||
log_info("Kernel began %s.", format_timestamp(s, sizeof(s), k.realtime));
|
||||
log_info("Firmware began %s.", FORMAT_TIMESTAMP(fw.realtime));
|
||||
log_info("Loader began %s.", FORMAT_TIMESTAMP(l.realtime));
|
||||
log_info("Kernel began %s.", FORMAT_TIMESTAMP(k.realtime));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -18,14 +18,14 @@ int main(int argc, char *argv[]) {
|
||||
if (fd < 0)
|
||||
log_error_errno(errno, "Failed to open root directory: %m");
|
||||
else {
|
||||
char ts[FORMAT_TIMESTAMP_MAX], bs[FORMAT_BYTES_MAX];
|
||||
char bs[FORMAT_BYTES_MAX];
|
||||
BtrfsSubvolInfo info;
|
||||
|
||||
r = btrfs_subvol_get_info_fd(fd, 0, &info);
|
||||
if (r < 0)
|
||||
log_error_errno(r, "Failed to get subvolume info: %m");
|
||||
else {
|
||||
log_info("otime: %s", format_timestamp(ts, sizeof(ts), info.otime));
|
||||
log_info("otime: %s", FORMAT_TIMESTAMP(info.otime));
|
||||
log_info("read-only (search): %s", yes_no(info.read_only));
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,6 @@ static void _test_one(int line, const char *input, const char *output) {
|
||||
CalendarSpec *c;
|
||||
_cleanup_free_ char *p = NULL, *q = NULL;
|
||||
usec_t u;
|
||||
char buf[FORMAT_TIMESTAMP_MAX];
|
||||
int r;
|
||||
|
||||
assert_se(calendar_spec_from_string(input, &c) >= 0);
|
||||
@ -22,7 +21,7 @@ static void _test_one(int line, const char *input, const char *output) {
|
||||
|
||||
u = now(CLOCK_REALTIME);
|
||||
r = calendar_spec_next_usec(c, u, &u);
|
||||
log_info("Next: %s", r < 0 ? strerror_safe(r) : format_timestamp(buf, sizeof buf, u));
|
||||
log_info("Next: %s", r < 0 ? strerror_safe(r) : FORMAT_TIMESTAMP(u));
|
||||
calendar_spec_free(c);
|
||||
|
||||
assert_se(calendar_spec_from_string(p, &c) >= 0);
|
||||
|
@ -51,9 +51,7 @@ cleanup:
|
||||
}
|
||||
|
||||
static void test_getcrtime(void) {
|
||||
|
||||
_cleanup_close_ int fd = -1;
|
||||
char ts[FORMAT_TIMESTAMP_MAX];
|
||||
const char *vt;
|
||||
usec_t usec, k;
|
||||
int r;
|
||||
@ -67,7 +65,7 @@ static void test_getcrtime(void) {
|
||||
if (r < 0)
|
||||
log_debug_errno(r, "btime: %m");
|
||||
else
|
||||
log_debug("btime: %s", format_timestamp(ts, sizeof(ts), usec));
|
||||
log_debug("btime: %s", FORMAT_TIMESTAMP(usec));
|
||||
|
||||
k = now(CLOCK_REALTIME);
|
||||
|
||||
|
@ -717,7 +717,7 @@ static int print_timesync_property(const char *name, const char *expected_value,
|
||||
case SD_BUS_TYPE_STRUCT:
|
||||
if (streq(name, "NTPMessage")) {
|
||||
_cleanup_(ntp_status_info_clear) NTPStatusInfo i = {};
|
||||
char ts[FORMAT_TIMESPAN_MAX], stamp[FORMAT_TIMESTAMP_MAX];
|
||||
char ts[FORMAT_TIMESPAN_MAX];
|
||||
|
||||
r = map_ntp_message(NULL, NULL, m, NULL, &i);
|
||||
if (r < 0)
|
||||
@ -743,14 +743,10 @@ static int print_timesync_property(const char *name, const char *expected_value,
|
||||
else
|
||||
printf(" Reference=%" PRIX32 ",", be32toh(i.reference.val));
|
||||
|
||||
printf(" OriginateTimestamp=%s,",
|
||||
format_timestamp(stamp, sizeof(stamp), i.origin));
|
||||
printf(" ReceiveTimestamp=%s,",
|
||||
format_timestamp(stamp, sizeof(stamp), i.recv));
|
||||
printf(" TransmitTimestamp=%s,",
|
||||
format_timestamp(stamp, sizeof(stamp), i.trans));
|
||||
printf(" DestinationTimestamp=%s,",
|
||||
format_timestamp(stamp, sizeof(stamp), i.dest));
|
||||
printf(" OriginateTimestamp=%s,", FORMAT_TIMESTAMP(i.origin));
|
||||
printf(" ReceiveTimestamp=%s,", FORMAT_TIMESTAMP(i.recv));
|
||||
printf(" TransmitTimestamp=%s,", FORMAT_TIMESTAMP(i.trans));
|
||||
printf(" DestinationTimestamp=%s,", FORMAT_TIMESTAMP(i.dest));
|
||||
printf(" Ignored=%s PacketCount=%" PRIu64 ",",
|
||||
yes_no(i.spike), i.packet_count);
|
||||
printf(" Jitter=%s }\n",
|
||||
|
Loading…
Reference in New Issue
Block a user