chiark / gitweb /
Prep v228: Add remaining updates from upstream (2/3)
[elogind.git] / src / basic / time-util.h
index 08b2bfb82bd8ec00743ec40bd104236dcceb2118..d5c567eafaed03d1e5cfe9921e41aa8e45742494 100644 (file)
@@ -21,8 +21,9 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <stdio.h>
 #include <inttypes.h>
+#include <stdio.h>
+#include <time.h>
 
 typedef uint64_t usec_t;
 typedef uint64_t nsec_t;
@@ -103,15 +104,23 @@ 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);
+int parse_time(const char *t, usec_t *usec, usec_t default_unit);
+// UNNEEDED int parse_nsec(const char *t, nsec_t *nsec);
 
 // UNNEEDED bool ntp_synced(void);
 
 // UNNEEDED int get_timezones(char ***l);
-bool timezone_is_valid(const char *name);
+// UNNEEDED bool timezone_is_valid(const char *name);
+
+// UNNEEDED clockid_t clock_boottime_or_monotonic(void);
+
+#define xstrftime(buf, fmt, tm) \
+        assert_message_se(strftime(buf, ELEMENTSOF(buf), fmt, tm) > 0, \
+                          "xstrftime: " #buf "[] must be big enough")
 
-clockid_t clock_boottime_or_monotonic(void);
+// UNNEEDED int get_timezone(char **timezone);
 
-#define xstrftime(buf, fmt, tm) assert_se(strftime(buf, ELEMENTSOF(buf), fmt, tm) > 0)
+// UNNEEDED time_t mktime_or_timegm(struct tm *tm, bool utc);
+struct tm *localtime_or_gmtime_r(const time_t *t, struct tm *tm, bool utc);
 
-int get_timezone(char **timezone);
+// UNNEEDED unsigned long usec_to_jiffies(usec_t usec);