From e817ed9d48ac974181c1a45ad193c7f924503c81 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Wed, 19 Jan 2022 20:40:44 +0100 Subject: sfeed: extend the time range, use long long instead of time_t This allows to parse the time as a number in the 64-bit range, even on 32-bit platforms. Note that the sfeed formatting tools can still truncate/wrap the value to time_t, which can be 32-bit. --- sfeed.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/sfeed.c b/sfeed.c index e34e90a..2e9c364 100644 --- a/sfeed.c +++ b/sfeed.c @@ -1,5 +1,3 @@ -#include - #include #include #include @@ -103,7 +101,7 @@ static FeedTag * gettag(enum FeedType, const char *, size_t); static long gettzoffset(const char *); static int isattr(const char *, size_t, const char *, size_t); static int istag(const char *, size_t, const char *, size_t); -static int parsetime(const char *, time_t *); +static int parsetime(const char *, long long *); static void printfields(void); static void string_append(String *, const char *, size_t); static void string_buffer_realloc(String *, size_t); @@ -425,13 +423,13 @@ string_print_uri(String *s) void string_print_timestamp(String *s) { - time_t t; + long long t; if (!s->data || !s->len) return; if (parsetime(s->data, &t) != -1) - printf("%lld", (long long)t); + printf("%lld", t); } long long @@ -541,7 +539,7 @@ gettzoffset(const char *s) } static int -parsetime(const char *s, time_t *tp) +parsetime(const char *s, long long *tp) { static struct { char *name; -- cgit v1.2.3