chiark / gitweb /
util-lib: move formats-util.h from shared/ to basic/
[elogind.git] / src / basic / time-util.h
index 5913639ec8e4dfb4c1d90a0b6bf8153792691e98..ef49343a8211e964341959cb5b86a56d9823f20b 100644 (file)
@@ -70,10 +70,12 @@ typedef struct dual_timestamp {
 #define DUAL_TIMESTAMP_NULL ((struct dual_timestamp) { 0ULL, 0ULL })
 
 usec_t now(clockid_t clock);
+// UNNEEDED nsec_t now_nsec(clockid_t clock);
 
 dual_timestamp* dual_timestamp_get(dual_timestamp *ts);
 dual_timestamp* dual_timestamp_from_realtime(dual_timestamp *ts, usec_t u);
 // UNNEEDED dual_timestamp* dual_timestamp_from_monotonic(dual_timestamp *ts, usec_t u);
+// UNNEEDED dual_timestamp* dual_timestamp_from_boottime_or_monotonic(dual_timestamp *ts, usec_t u);
 
 static inline bool dual_timestamp_is_set(dual_timestamp *ts) {
         return ((ts->realtime > 0 && ts->realtime != USEC_INFINITY) ||
@@ -86,6 +88,8 @@ 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);
 
+nsec_t timespec_load_nsec(const struct timespec *ts) _pure_;
+
 char *format_timestamp(char *buf, size_t l, usec_t t);
 // UNNEEDED char *format_timestamp_utc(char *buf, size_t l, usec_t t);
 char *format_timestamp_us(char *buf, size_t l, usec_t t);
@@ -99,7 +103,7 @@ char *format_timespan(char *buf, size_t l, usec_t t, usec_t accuracy);
 // UNNEEDED int parse_timestamp(const char *t, usec_t *usec);
 
 int parse_sec(const char *t, usec_t *usec);
-int parse_nsec(const char *t, nsec_t *nsec);
+// UNNEEDED int parse_nsec(const char *t, nsec_t *nsec);
 
 // UNNEEDED bool ntp_synced(void);
 
@@ -108,4 +112,8 @@ int parse_nsec(const char *t, nsec_t *nsec);
 
 // UNNEEDED clockid_t clock_boottime_or_monotonic(void);
 
-#define xstrftime(buf, fmt, tm) assert_se(strftime(buf, ELEMENTSOF(buf), fmt, tm) > 0)
+#define xstrftime(buf, fmt, tm) \
+        assert_message_se(strftime(buf, ELEMENTSOF(buf), fmt, tm) > 0, \
+                          "xstrftime: " #buf "[] must be big enough")
+
+// UNNEEDED int get_timezone(char **timezone);