commit d2f63645bf165726384f50f4e8b0f3ee048e7ae3
parent daf56f2cb0a6994c4be8f1b57f1eb4b4cb8c91ba
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sun, 26 Mar 2023 15:26:08 +0200
sfeed.c: datetounix: fix incorrect int type to long
Found while testing sfeed on MS-DOS with Open Watcom (for fun :)).
There an int is 16-bit and sfeed incorrectly wrapped the value, which produced
incorrect parsed UNIX timestamps as output.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sfeed.c b/sfeed.c
@@ -436,7 +436,7 @@ string_print_timestamp(String *s)
static long long
datetounix(long long year, int mon, int day, int hour, int min, int sec)
{
- static const int secs_through_month[] = {
+ static const long secs_through_month[] = {
0, 31 * 86400, 59 * 86400, 90 * 86400,
120 * 86400, 151 * 86400, 181 * 86400, 212 * 86400,
243 * 86400, 273 * 86400, 304 * 86400, 334 * 86400 };