commit 957b54083396493815892a5ad51d929d9cfd0bc6
parent 78e6d608ba2dcb769eda0f1e5b8047027279dd87
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Mon, 20 Oct 2025 17:03:44 +0200
stardis: calculate the position of the sun in real time
Calculate the position of the sun using the random walk time rather than
the time at the center of the meteorological data time interval, which
includes the current random walk time.
Diffstat:
1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/src/stardis_smeteo.c b/src/stardis_smeteo.c
@@ -202,21 +202,10 @@ compute_sun_position
/* Time and date */
struct tm date_utc0 = {0};
time_t time_since_jan_1_1850_utc0 = 0; /* [s] */
- time_t time_since_jan_1_1850_local = 0; /* [s] */
- /* Miscellaneous */
- size_t i = 0; /* Index of the meteo entry including "time" */
res_T res = RES_OK;
-
ASSERT(bcond && sun);
- i = get_meteo_entry_id(bcond, time);
-
- /* Calculate the number of seconds elapsed since
- * January 1, 1850, local time */
- time_since_jan_1_1850_local = /* [s] */
- (time_t)(bcond->lib_desc.smeteo_desc.entries[i].day_1850 * 24 * 3600);
-
/* The limit condition stores the number of seconds elapsed since the epoch
* until January 1, 1850, local time. In other words, since the epoch is
* expressed in UTC+00:00, it defines an offset in seconds between local
@@ -224,7 +213,7 @@ compute_sun_position
* number of seconds elapsed since January 1, 1850, local time, to convert
* this number of seconds to UTC+00:00. */
time_since_jan_1_1850_utc0 = /* [s] */
- bcond->lib_desc.jan_1_1850 + time_since_jan_1_1850_local;
+ (time_t)((double)bcond->lib_desc.jan_1_1850 + time);
/* Convert time in number of seconds into a broken-down time as expected by
* the Star-CElestial-Mechanics library */