From 60ead8402c4d4e19affa93f81cdf0029f426d66d Mon Sep 17 00:00:00 2001 From: chad-iris Date: Tue, 10 Oct 2017 18:55:08 -0700 Subject: [PATCH] Update libmseed to 2.19.5, with fix for leap second calculation --- ChangeLog | 3 +++ libmseed/ChangeLog | 7 +++++++ libmseed/README.md | 2 ++ libmseed/doc/ms_time.3 | 4 ++++ libmseed/libmseed.def | 1 + libmseed/libmseed.h | 4 ++-- libmseed/msrutils.c | 12 ++++++++++-- libmseed/unpackdata.c | 8 ++++---- src/msi.c | 2 +- 9 files changed, 34 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index f87cff5..b2ce32b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2017.283: 3.8 + - Update libmseed to 2.19.5, with fix for leap second calculation. + 2017.136: 3.7 - Update libmseed to 2.19.4. - Remove Windows/Watcom build files and documentation, this will not build diff --git a/libmseed/ChangeLog b/libmseed/ChangeLog index 8c766f1..7f8e09d 100644 --- a/libmseed/ChangeLog +++ b/libmseed/ChangeLog @@ -1,3 +1,10 @@ +2017.283: 2.19.5 + - msr_endtime(): calculate correct end time during a leap second. + - Fixed signedness comparison warning. + +2017.125: + - Export LM_SIZEOF_OFF_T on Windows via libmseed.def. + 2017.118: 2.19.4 - Add global LM_SIZEOF_OFF_T variable that is set to the size of the off_t data type as determined at compile time. diff --git a/libmseed/README.md b/libmseed/README.md index 1a7cb33..7324df4 100644 --- a/libmseed/README.md +++ b/libmseed/README.md @@ -56,3 +56,5 @@ in the ChangeLog. This library also uses code bits published in the public domain and acknowledgement is included in the code whenever possible. + +With software provided by http://2038bug.com/ (site offline, checked Oct. 2017) diff --git a/libmseed/doc/ms_time.3 b/libmseed/doc/ms_time.3 index 5c5c367..d9d1c63 100644 --- a/libmseed/doc/ms_time.3 +++ b/libmseed/doc/ms_time.3 @@ -191,6 +191,10 @@ values. A special value defined as HPTERROR in libmseed.h is used to represent errors for routines returning hptime. +.SH ACKNOWLEDGEMENTS + +With software provided by http://2038bug.com/ (site offline, checked Oct. 2017) + .SH AUTHOR .nf Chad Trabant diff --git a/libmseed/libmseed.def b/libmseed/libmseed.def index f415164..4be57c3 100644 --- a/libmseed/libmseed.def +++ b/libmseed/libmseed.def @@ -102,3 +102,4 @@ EXPORTS ms_gswap2a ms_gswap4a ms_gswap8a + LM_SIZEOF_OFF_T diff --git a/libmseed/libmseed.h b/libmseed/libmseed.h index 87adb84..f708dc0 100644 --- a/libmseed/libmseed.h +++ b/libmseed/libmseed.h @@ -28,8 +28,8 @@ extern "C" { #endif -#define LIBMSEED_VERSION "2.19.4" -#define LIBMSEED_RELEASE "2017.118" +#define LIBMSEED_VERSION "2.19.5" +#define LIBMSEED_RELEASE "2017.283" /* C99 standard headers */ #include diff --git a/libmseed/msrutils.c b/libmseed/msrutils.c index 314f02d..76a66ff 100644 --- a/libmseed/msrutils.c +++ b/libmseed/msrutils.c @@ -7,7 +7,7 @@ * ORFEUS/EC-Project MEREDIAN * IRIS Data Management Center * - * modified: 2016.286 + * modified: 2016.283 ***************************************************************************/ #include @@ -571,6 +571,14 @@ msr_starttime_uc (MSRecord *msr) * actual last sample time and *not* the time "covered" by the last * sample. * + * On the epoch time scale the value of a leap second is the same as + * the second following the leap second, without external information + * the values are ambiguous. + * + * Leap second handling: when a record completely contains a leap + * second, starts before and ends after, the calculated end time will + * be adjusted (reduced) by one second. + * * Returns the time of the last sample as a high precision epoch time * on success and HPTERROR on error. ***************************************************************************/ @@ -592,7 +600,7 @@ msr_endtime (MSRecord *msr) while (lslist) { if (lslist->leapsecond > msr->starttime && - lslist->leapsecond < (msr->starttime + span)) + lslist->leapsecond <= (msr->starttime + span - HPTMODULUS)) { span -= HPTMODULUS; break; diff --git a/libmseed/unpackdata.c b/libmseed/unpackdata.c index 3ef84a2..24d30ff 100644 --- a/libmseed/unpackdata.c +++ b/libmseed/unpackdata.c @@ -3,7 +3,7 @@ * STEIM2, GEOSCOPE (24bit and gain ranged), CDSN, SRO and DWWSSN * encoded data. * - * modified: 2017.053 + * modified: 2017.283 ************************************************************************/ #include @@ -628,7 +628,7 @@ msr_decode_geoscope (char *input, int samplecount, float *output, mantissa = sample32.i; /* Take 2's complement for mantissa for overflow */ - if (mantissa > MAX24) + if ((unsigned long)mantissa > MAX24) mantissa -= 2 * (MAX24 + 1); /* Store */ @@ -851,7 +851,7 @@ msr_decode_sro (int16_t *input, int samplecount, int32_t *output, gainrange = (sint & SRO_GAINRANGE_MASK) >> SRO_SHIFT; /* Take 2's complement for mantissa */ - if (mantissa > MAX12) + if ((unsigned long)mantissa > MAX12) mantissa -= 2 * (MAX12 + 1); /* Calculate exponent, SRO exponent = 0..10 */ @@ -902,7 +902,7 @@ msr_decode_dwwssn (int16_t *input, int samplecount, int32_t *output, sample = (int32_t)sint; /* Take 2's complement for sample */ - if (sample > MAX16) + if ((unsigned long)sample > MAX16) sample -= 2 * (MAX16 + 1); /* Save sample in output array */ diff --git a/src/msi.c b/src/msi.c index fa82356..327532f 100644 --- a/src/msi.c +++ b/src/msi.c @@ -31,7 +31,7 @@ static int addfile (char *filename); static int addlistfile (char *filename); static void usage (void); -#define VERSION "3.7" +#define VERSION "3.8" #define PACKAGE "msi" static flag verbose = 0;