commit 9d88f450dff9c7cf7dd6db112a1e0e0eb134256f parent 50124d1fcd9ad3460b6f4d790b23c43ec40cebcb Author: Vincent Forest <vincent.forest@meso-star.com> Date: Mon, 29 Sep 2025 17:12:27 +0200 Fix the Julian day calculation from a tm structure The month index was supposed to be between [1,12], whereas it is between [0,11]. Diffstat:
| M | src/scem.c | | | 4 | ++-- |
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/scem.c b/src/scem.c @@ -46,8 +46,8 @@ julian_day(const struct tm* time) /* In UTC */ + (double)time->tm_hour/24.0 + (double)time->tm_min/1440.0 + (double)time->tm_sec/86400.0; - m = time->tm_mon; - y = time->tm_year+1900; /* tm_year is relative to year 1900 (see tm(3type)) */ + m = time->tm_mon + 1; /* The months start at 0 */ + y = time->tm_year + 1900; /* tm_year is relative to year 1900 (see tm(3type)) */ if((unsigned)time->tm_mon < 3) { y -= 1;