From 2a5da82403f3ee9a2f4dc165f50e62ca323edd30 Mon Sep 17 00:00:00 2001 From: Uwe Schulzweida <uwe.schulzweida@mpimet.mpg.de> Date: Thu, 19 Sep 2024 08:43:22 +0200 Subject: [PATCH] absolute timeaxis failed with timeunits seconds [Bug #11916] --- ChangeLog | 8 ++++++++ src/stream_cdf_time.c | 8 +++----- src/taxis.c | 5 ++++- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index be3386e10..c0a4b58d7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2024-09-19 Uwe Schulzweida + + * Version 2.4.4 released + +2024-09-18 Uwe Schulzweida + + * absolute timeaxis failed with timeunits seconds [Bug #11916] + 2024-08-14 Uwe Schulzweida * Version 2.4.3 released diff --git a/src/stream_cdf_time.c b/src/stream_cdf_time.c index 62d8a29a9..dc594c44d 100644 --- a/src/stream_cdf_time.c +++ b/src/stream_cdf_time.c @@ -203,11 +203,9 @@ cdfDefTime(stream_t *streamptr) } else { - /* define bogus value since at this time, streamDefTimestep has - * not been called yet - * but since taxis->units is not set, it clearly will not - * exceed the size of unitstr_, i.e. when defining the units - * attribute to this value, a later redefinition will not + /* define bogus value since at this time, streamDefTimestep has not been called yet + * but since taxis->units is not set, it clearly will not exceed the size of unitstr_, + * i.e. when defining the units attribute to this value, a later redefinition will not * cause a recreation of on-disk data */ for (size_t i = 0; i < CDF_MAX_TIME_UNIT_STR; ++i) unitsStr_[i] = 'a'; diff --git a/src/taxis.c b/src/taxis.c index a22ffb4e2..5acf45b57 100644 --- a/src/taxis.c +++ b/src/taxis.c @@ -1289,6 +1289,7 @@ cdi_decode_timeval(double timevalue, const taxis_t *taxis) return (taxis->type == TAXIS_ABSOLUTE) ? split_timevalue(timevalue, taxis->unit) : rtimeval2datetime(timevalue, taxis); } +/* static int64_t datetime2seconds(CdiDateTime datetime) { @@ -1305,7 +1306,7 @@ datetime2seconds(CdiDateTime datetime) return seconds; } - +*/ double cdi_encode_timeval(CdiDateTime datetime, taxis_t *taxis) { @@ -1322,10 +1323,12 @@ cdi_encode_timeval(CdiDateTime datetime, taxis_t *taxis) int64_t xdate = cdiDate_get(datetime.date); timeValue = (double) xdate / 100 + copysign((double) (datetime.date.day != 0) * 0.5, (double) xdate); } + /* else if (taxis->unit == TUNIT_SECOND) { timeValue = (double) datetime2seconds(datetime); } + */ else { int hour, minute, second, ms; -- GitLab