summaryrefslogtreecommitdiff
path: root/src/journal/journalctl.c
diff options
context:
space:
mode:
authorJan Synacek <jsynacek@redhat.com>2014-10-02 14:39:29 +0200
committerLennart Poettering <lennart@poettering.net>2014-10-02 14:52:32 +0200
commit9fd290443f5f99fca0dcd4216b1de70f7d3b8db1 (patch)
tree4d486eed4efd28017883e0876a92a21abe5a63ad /src/journal/journalctl.c
parentb344bcbbfda8fbe14dadc5aa4b5dfb3ced6d76e2 (diff)
journalctl: add --utc option
Introduce option to display time in UTC.
Diffstat (limited to 'src/journal/journalctl.c')
-rw-r--r--src/journal/journalctl.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index 89a922c067..395f85c9ae 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -63,6 +63,7 @@
#define DEFAULT_FSS_INTERVAL_USEC (15*USEC_PER_MINUTE)
static OutputMode arg_output = OUTPUT_SHORT;
+static bool arg_utc = false;
static bool arg_pager_end = false;
static bool arg_follow = false;
static bool arg_full = true;
@@ -191,6 +192,7 @@ static void help(void) {
" -o --output=STRING Change journal output mode (short, short-iso,\n"
" short-precise, short-monotonic, verbose,\n"
" export, json, json-pretty, json-sse, cat)\n"
+ " --utc Express time in Coordinated Universal Time (UTC)\n"
" -x --catalog Add message explanations where available\n"
" --no-full Ellipsize fields\n"
" -a --all Show all fields, including long and unprintable\n"
@@ -250,6 +252,7 @@ static int parse_argv(int argc, char *argv[]) {
ARG_DUMP_CATALOG,
ARG_UPDATE_CATALOG,
ARG_FORCE,
+ ARG_UTC,
};
static const struct option options[] = {
@@ -299,6 +302,7 @@ static int parse_argv(int argc, char *argv[]) {
{ "update-catalog", no_argument, NULL, ARG_UPDATE_CATALOG },
{ "reverse", no_argument, NULL, 'r' },
{ "machine", required_argument, NULL, 'M' },
+ { "utc", no_argument, NULL, ARG_UTC },
{}
};
@@ -639,6 +643,10 @@ static int parse_argv(int argc, char *argv[]) {
arg_reverse = true;
break;
+ case ARG_UTC:
+ arg_utc = true;
+ break;
+
case '?':
return -EINVAL;
@@ -1958,7 +1966,8 @@ int main(int argc, char *argv[]) {
arg_all * OUTPUT_SHOW_ALL |
arg_full * OUTPUT_FULL_WIDTH |
on_tty() * OUTPUT_COLOR |
- arg_catalog * OUTPUT_CATALOG;
+ arg_catalog * OUTPUT_CATALOG |
+ arg_utc * OUTPUT_UTC;
r = output_journal(stdout, j, arg_output, 0, flags, &ellipsized);
need_seek = true;