diff options
author | Lennart Poettering <lennart@poettering.net> | 2012-10-17 02:50:09 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2012-10-17 21:25:42 +0200 |
commit | 6d0274f11547a0f11200bb82bf598a5a253e12cf (patch) | |
tree | cdca61ea9c8a3c120e53c212dab318ffa141c129 /src/shared | |
parent | 22349cee29b31cde7ef8582b4882475f553af97a (diff) |
timedatectl: introduce new command line client for timedated
Much like logind has a client in loginctl, and journald in journalctl
introduce timedatectl, to change the system time (incl. RTC), timezones
and related settings.
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/dbus-common.h | 1 | ||||
-rw-r--r-- | src/shared/macro.h | 1 | ||||
-rw-r--r-- | src/shared/strv.c | 8 | ||||
-rw-r--r-- | src/shared/strv.h | 1 | ||||
-rw-r--r-- | src/shared/util.c | 2 |
5 files changed, 12 insertions, 1 deletions
diff --git a/src/shared/dbus-common.h b/src/shared/dbus-common.h index 394ab4cb60..005a715d0a 100644 --- a/src/shared/dbus-common.h +++ b/src/shared/dbus-common.h @@ -22,6 +22,7 @@ ***/ #include <dbus/dbus.h> +#include <inttypes.h> #ifndef DBUS_ERROR_UNKNOWN_OBJECT #define DBUS_ERROR_UNKNOWN_OBJECT "org.freedesktop.DBus.Error.UnknownObject" diff --git a/src/shared/macro.h b/src/shared/macro.h index dbdf5b3fb0..e930fdab53 100644 --- a/src/shared/macro.h +++ b/src/shared/macro.h @@ -192,6 +192,7 @@ static inline size_t IOVEC_INCREMENT(struct iovec *i, unsigned n, size_t k) { #define _cleanup_close_ __attribute__((cleanup(closep))) #define _cleanup_closedir_ __attribute__((cleanup(closedirp))) #define _cleanup_umask_ __attribute__((cleanup(umaskp))) +#define _cleanup_strv_free_ __attribute__((cleanup(strv_freep))) #define VA_FORMAT_ADVANCE(format, ap) \ do { \ diff --git a/src/shared/strv.c b/src/shared/strv.c index c8d856344c..822b2dc888 100644 --- a/src/shared/strv.c +++ b/src/shared/strv.c @@ -64,6 +64,14 @@ void strv_free(char **l) { free(l); } +void strv_freep(char ***l) { + if (!l) + return; + + strv_free(*l); + *l = NULL; +} + char **strv_copy(char **l) { char **r, **k; diff --git a/src/shared/strv.h b/src/shared/strv.h index ae4e31f14c..81e33356f9 100644 --- a/src/shared/strv.h +++ b/src/shared/strv.h @@ -30,6 +30,7 @@ char *strv_find(char **l, const char *name); char *strv_find_prefix(char **l, const char *name); void strv_free(char **l); +void strv_freep(char ***l); char **strv_copy(char **l) _malloc_; unsigned strv_length(char **l); diff --git a/src/shared/util.c b/src/shared/util.c index 1e1eb2af5f..50c4c08993 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -1959,7 +1959,7 @@ char *format_timestamp(char *buf, size_t l, usec_t t) { sec = (time_t) (t / USEC_PER_SEC); - if (strftime(buf, l, "%a, %d %b %Y %H:%M:%S %z", localtime_r(&sec, &tm)) <= 0) + if (strftime(buf, l, "%a, %Y-%m-%d %H:%M:%S %Z", localtime_r(&sec, &tm)) <= 0) return NULL; return buf; |