aboutsummaryrefslogtreecommitdiff
path: root/lib/xwrap.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/xwrap.c')
-rw-r--r--lib/xwrap.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/xwrap.c b/lib/xwrap.c
index 555fbd5e..5f18f295 100644
--- a/lib/xwrap.c
+++ b/lib/xwrap.c
@@ -1077,3 +1077,16 @@ char *xgetline(FILE *fp, int *len)
return new;
}
+
+time_t xmktime(struct tm *tm, int utc)
+{
+ char *old_tz = utc ? xtzset("UTC0") : 0;
+ time_t result;
+
+ if ((result = mktime(tm)) < 0) error_exit("mktime");
+ if (utc) {
+ free(xtzset(old_tz));
+ free(old_tz);
+ }
+ return result;
+}