summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-10-08 22:37:45 +0200
committerLennart Poettering <lennart@poettering.net>2014-10-08 22:37:45 +0200
commit5ab99e076c72a44f2e174e48abd9945cd0180d76 (patch)
tree7d766229e37a2a2cd26ee77001ffd9f45c31ddcc /src/shared
parent5329ab10ffaf5b4a3fd6ebd9380b1ec09d05cfc8 (diff)
time: functions named "internal" really shouldn't be exported
Also, let's try to make function names descriptive, instead of using bools for flags.
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/logs-show.c4
-rw-r--r--src/shared/time-util.c16
-rw-r--r--src/shared/time-util.h5
3 files changed, 20 insertions, 5 deletions
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
index e30e6865ac..3d742491c9 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -447,7 +447,9 @@ static int output_verbose(
}
fprintf(f, "%s [%s]\n",
- format_timestamp_us(ts, sizeof(ts), realtime, flags & OUTPUT_UTC),
+ flags & OUTPUT_UTC ?
+ format_timestamp_us_utc(ts, sizeof(ts), realtime) :
+ format_timestamp_us(ts, sizeof(ts), realtime),
cursor);
JOURNAL_FOREACH_DATA_RETVAL(j, data, length, r) {
diff --git a/src/shared/time-util.c b/src/shared/time-util.c
index 09f4a21354..433c262dfa 100644
--- a/src/shared/time-util.c
+++ b/src/shared/time-util.c
@@ -152,7 +152,7 @@ struct timeval *timeval_store(struct timeval *tv, usec_t u) {
return tv;
}
-char *format_timestamp_internal(char *buf, size_t l, usec_t t, bool utc) {
+static char *format_timestamp_internal(char *buf, size_t l, usec_t t, bool utc) {
struct tm tm;
time_t sec;
@@ -178,7 +178,11 @@ char *format_timestamp(char *buf, size_t l, usec_t t) {
return format_timestamp_internal(buf, l, t, false);
}
-char *format_timestamp_us(char *buf, size_t l, usec_t t, bool utc) {
+char *format_timestamp_utc(char *buf, size_t l, usec_t t) {
+ return format_timestamp_internal(buf, l, t, true);
+}
+
+static char *format_timestamp_internal_us(char *buf, size_t l, usec_t t, bool utc) {
struct tm tm;
time_t sec;
@@ -203,6 +207,14 @@ char *format_timestamp_us(char *buf, size_t l, usec_t t, bool utc) {
return buf;
}
+char *format_timestamp_us(char *buf, size_t l, usec_t t) {
+ return format_timestamp_internal_us(buf, l, t, false);
+}
+
+char *format_timestamp_us_utc(char *buf, size_t l, usec_t t) {
+ return format_timestamp_internal_us(buf, l, t, true);
+}
+
char *format_timestamp_relative(char *buf, size_t l, usec_t t) {
const char *s;
usec_t n, d;
diff --git a/src/shared/time-util.h b/src/shared/time-util.h
index 16cc593cf5..05369d295b 100644
--- a/src/shared/time-util.h
+++ b/src/shared/time-util.h
@@ -84,9 +84,10 @@ struct timespec *timespec_store(struct timespec *ts, usec_t u);
usec_t timeval_load(const struct timeval *tv) _pure_;
struct timeval *timeval_store(struct timeval *tv, usec_t u);
-char *format_timestamp_internal(char *buf, size_t l, usec_t t, bool utc);
char *format_timestamp(char *buf, size_t l, usec_t t);
-char *format_timestamp_us(char *buf, size_t l, usec_t t, bool utc);
+char *format_timestamp_utc(char *buf, size_t l, usec_t t);
+char *format_timestamp_us(char *buf, size_t l, usec_t t);
+char *format_timestamp_us_utc(char *buf, size_t l, usec_t t);
char *format_timestamp_relative(char *buf, size_t l, usec_t t);
char *format_timespan(char *buf, size_t l, usec_t t, usec_t accuracy);