DOKK / manpages / debian 12 / libmseed-doc / msr_endtime.3.en
MSR_STARTTIME(3) Library Functions Manual MSR_STARTTIME(3)

msr_starttime - Start and end time determination for MSRecord structures

#include <libmseed.h>
hptime_t  msr_starttime ( MSRecord *msr );
hptime_t  msr_starttime_uc ( MSRecord *msr );
hptime_t  msr_endtime ( MSRecord *msr );

msr_starttime returns the start time of the record as a high precision epoch time (see ms_time(3)). Any time correction given in the fixed section data header is applied if it has not already been applied. If Blockette 1001 is included and parsed the microseconds indicated (field 4) are also applied.

NOTE: The record start time for a MSRecord structure is available directly at MSRecord.starttime. Libmseed based programs should use that start time whenever possible (msr_unpack uses msr_starttime to set MSRecord.starttime).

msr_starttime_uc is a version of msr_starttime that applies no time corrections, just a basic conversion of the start time values in the fixed section data header.

msr_endtime returns the time of the last sample in the record as a high precision epoch time (seed ms_time(3)). This is *not* the time "covered" by the last sample, but the actual sample time. This function calculates the record start time with msr_starttime and then adds the time covered by the samples in the record which is calculated from the number of samples and sample rate.

msr_endtime will adjust the end time appropriately if the record is known to contain a positive leap second. If the ms_readleapseconds or ms_readleapsecondfile routines have been called to read a leap second file into an internal list, it will be checked to know when leap seconds occur. If a leap second list is not available the fixed section data header is checked for a positive leap second indicator.

msr_starttime, msr_starttime_uc and msr_endtime return a high precision epoch time on success and HPTERROR on error.

ms_intro(3), ms_time(3) and msr_unpack(3)

Chad Trabant
IRIS Data Management Center
2015/03/02 Libmseed API