analyze: split out "time" verb
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
#include "analyze.h"
|
||||
#include "analyze-time.h"
|
||||
#include "analyze-time-data.h"
|
||||
|
||||
int analyze_time(int argc, char *argv[], void *userdata) {
|
||||
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
|
||||
_cleanup_free_ char *buf = NULL;
|
||||
int r;
|
||||
|
||||
r = acquire_bus(&bus, NULL);
|
||||
if (r < 0)
|
||||
return bus_log_connect_error(r, arg_transport);
|
||||
|
||||
r = pretty_boot_time(bus, &buf);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
puts(buf);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#pragma once
|
||||
|
||||
int analyze_time(int argc, char *argv[], void *userdata);
|
||||
+1
-17
@@ -29,6 +29,7 @@
|
||||
#include "analyze-security.h"
|
||||
#include "analyze-service-watchdogs.h"
|
||||
#include "analyze-syscall-filter.h"
|
||||
#include "analyze-time.h"
|
||||
#include "analyze-time-data.h"
|
||||
#include "analyze-timespan.h"
|
||||
#include "analyze-timestamp.h"
|
||||
@@ -197,23 +198,6 @@ static int process_aliases(char *argv[], char *tempdir, char ***ret) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int analyze_time(int argc, char *argv[], void *userdata) {
|
||||
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
|
||||
_cleanup_free_ char *buf = NULL;
|
||||
int r;
|
||||
|
||||
r = acquire_bus(&bus, NULL);
|
||||
if (r < 0)
|
||||
return bus_log_connect_error(r, arg_transport);
|
||||
|
||||
r = pretty_boot_time(bus, &buf);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
puts(buf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void time_parsing_hint(const char *p, bool calendar, bool timestamp, bool timespan) {
|
||||
if (calendar && calendar_spec_from_string(p, NULL) >= 0)
|
||||
log_notice("Hint: this expression is a valid calendar specification. "
|
||||
|
||||
@@ -33,6 +33,8 @@ systemd_analyze_sources = files('''
|
||||
analyze-service-watchdogs.h
|
||||
analyze-syscall-filter.c
|
||||
analyze-syscall-filter.h
|
||||
analyze-time.c
|
||||
analyze-time.h
|
||||
analyze-time-data.c
|
||||
analyze-time-data.h
|
||||
analyze-timespan.c
|
||||
|
||||
Reference in New Issue
Block a user