summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorKarel Zak2016-05-11 15:31:02 +0200
committerKarel Zak2016-05-11 15:31:02 +0200
commit3c201431ee26c85b5c7fbcd85856c1df84065d64 (patch)
treea6ff93a95304bcf4f8241f409c2f3a6bf5c90ecb /include
parentramctl: add support for zram-control (diff)
downloadkernel-qcow2-util-linux-3c201431ee26c85b5c7fbcd85856c1df84065d64.tar.gz
kernel-qcow2-util-linux-3c201431ee26c85b5c7fbcd85856c1df84065d64.tar.xz
kernel-qcow2-util-linux-3c201431ee26c85b5c7fbcd85856c1df84065d64.zip
lib/timeutils: add strxxx_iso() functions
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/strutils.h2
-rw-r--r--include/timeutils.h13
2 files changed, 15 insertions, 0 deletions
diff --git a/include/strutils.h b/include/strutils.h
index 9f4339f41..f303450f5 100644
--- a/include/strutils.h
+++ b/include/strutils.h
@@ -212,6 +212,8 @@ static inline size_t ltrim_whitespace(unsigned char *str)
extern char *strnappend(const char *s, const char *suffix, size_t b);
extern char *strappend(const char *s, const char *suffix);
+extern char *strfappend(const char *s, const char *format, ...)
+ __attribute__ ((__format__ (__printf__, 2, 0)));
extern const char *split(const char **state, size_t *l, const char *separator, int quoted);
extern int skip_fline(FILE *fp);
diff --git a/include/timeutils.h b/include/timeutils.h
index 8ed501b9d..4b6098ae1 100644
--- a/include/timeutils.h
+++ b/include/timeutils.h
@@ -23,6 +23,7 @@
#include <stdio.h>
#include <inttypes.h>
+#include <sys/time.h>
typedef uint64_t usec_t;
typedef uint64_t nsec_t;
@@ -53,4 +54,16 @@ typedef uint64_t nsec_t;
int parse_timestamp(const char *t, usec_t *usec);
+/* flags for strxxx_iso() functions */
+enum {
+ ISO_8601_DATE = (1 << 1),
+ ISO_8601_TIME = (1 << 2),
+ ISO_8601_USEC = (1 << 3),
+ ISO_8601_TIMEZONE = (1 << 4),
+ ISO_8601_SPACE = (1 << 5)
+};
+char *strtimeval_iso(struct timeval *tv, int flags);
+char *strtm_iso(struct tm *tm, int flags);
+char *strtime_iso(time_t t, int flags);
+
#endif /* UTIL_LINUX_TIME_UTIL_H */