MSR_STARTTIME(3)

πŸ’– MSR_STARTTIME πŸ’–

okay bestie, gather round, because we're talking about MSR_STARTTIME(3) from the Library Functions Manual β€” yes it's a libmseed thing, yes it's about time math, and yes it's lowkey iconic. πŸ•βœ¨


✨ NAME ✨

msr_starttime β€” figuring out the start and end times for MSRecord structures, no cap πŸŽ€


🌸 SYNOPSIS 🌸

#include <libmseed.h>

hptime_t  msr_starttime ( MSRecord *msr );

hptime_t  msr_starttime_uc ( MSRecord *msr );

hptime_t  msr_endtime ( MSRecord *msr );

πŸ’… DESCRIPTION πŸ’…

πŸ¦‹ msr_starttime

msr_starttime hands you back the start time of the record as a high precision epoch time (peep ms_time(3) for the deets 🫢). Any time correction that's sitting in the fixed section data header gets applied β€” but only if it hasn't already been applied, we're not out here double-correcting. And if Blockette 1001 is included and parsed, those microseconds it's carrying (field 4, bestie) get applied too. ✨

NOTE: the record start time for a MSRecord structure is literally right there at MSRecord.starttime. Libmseed based programs should use that start time whenever possible β€” like, whenever, fr fr. (Fun fact: msr_unpack uses msr_starttime to set MSRecord.starttime.) πŸ‘‘

🌈 msr_starttime_uc

msr_starttime_uc is the msr_starttime girlie who applies zero time corrections. It's just a basic conversion of the start time values in the fixed section data header. Simple. Clean. No drama. πŸ’…

πŸŽ€ msr_endtime

msr_endtime returns the time of the last sample in the record as a high precision epoch time (seed ms_time(3)). And bestie, listen β€” this is not the time "covered" by the last sample, it's the actual sample time. Important distinction, don't let anyone tell you otherwise. 😭

The way it works: it calculates the record start time with msr_starttime, then adds the time covered by the samples in the record, which it works out from the number of samples and the sample rate. Math ate. πŸ”₯

msr_endtime will also adjust the end time appropriately if the record is known to contain a positive leap second. If ms_readleapseconds or ms_readleapsecondfile have been called to read a leap second file into an internal list, that list gets checked so it knows when leap seconds occur. And if a leap second list is not available? No worries β€” the fixed section data header gets checked for a positive leap second indicator instead. 🧚


⭐ RETURN VALUES ⭐

msr_starttime, msr_starttime_uc and msr_endtime all return a high precision epoch time when things go right, and HPTERROR when they don't. πŸ’€


πŸ‘‘ SEE ALSO πŸ‘‘

ms_intro(3), ms_time(3) and msr_unpack(3) β€” go read them, iykyk πŸ“š


🫢 AUTHOR 🫢

Chad Trabant IRIS Data Management Center


and that's the whole page, bestie!! this one's from the Libmseed API, dated 2015/03/02 β€” vintage but still slaying πŸ’œ stay precise, stay corrected, and remember: HPTERROR is not a personality trait πŸŒΈπŸ’–