summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2022-01-19 20:40:44 +0100
committerHiltjo Posthuma <hiltjo@codemadness.org>2022-01-19 20:40:44 +0100
commite817ed9d48ac974181c1a45ad193c7f924503c81 (patch)
treeaadd27d1d2cf4394167fc76afb115a393db9df87
parent03bc1ec04b449df679a025bf1c57275aad341e69 (diff)
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.
-rw-r--r--sfeed.c10
1 files 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 <sys/types.h>
-
#include <ctype.h>
#include <errno.h>
#include <stdint.h>
@@ -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;