Commit 090ba308 authored by Mark Karpilovskij's avatar Mark Karpilovskij Committed by Daniel Salzman

contrib/time: UTC timezone patch

parent e19da590
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <limits.h> #include <limits.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include "contrib/time.h" #include "contrib/time.h"
...@@ -125,6 +126,9 @@ static knot_time_t time_ctx_finalize(time_ctx_t *ctx) ...@@ -125,6 +126,9 @@ static knot_time_t time_ctx_finalize(time_ctx_t *ctx)
ctx->calendar.tm_isdst = -1; ctx->calendar.tm_isdst = -1;
ctx->calendar.tm_year -= 1900; ctx->calendar.tm_year -= 1900;
ctx->calendar.tm_mon -= 1; ctx->calendar.tm_mon -= 1;
// Set UTC timezone before using mktime
putenv("TZ=UTC");
tzset();
return (knot_time_t)mktime(&ctx->calendar); return (knot_time_t)mktime(&ctx->calendar);
} else { } else {
return (knot_time_t)0; return (knot_time_t)0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment