MS_READLEAPSECONDS(3)

✨ MS_READLEAPSECONDS(3) ✨

okay bestie, gather round, this one's from the Library Functions Manual section of the libmseed docs and it's literally about reading leap second files. iconic behavior. πŸ’…


🌸 NAME 🌸

ms_readleapseconds β€” read a leap second file into a global buffer. that's it, that's the whole job, and she does it flawlessly.


πŸŽ€ SYNOPSIS πŸŽ€

#include <libmseed.h>

int  ms_readleapseconds ( char *envvarname );

int  ms_readleapsecondfile ( char *filename );

πŸ’– DESCRIPTION πŸ’–

so here's the tea, bestie β˜• β€” these functions read a leap seconds file and stash a whole list of leap seconds into an internal, global list. very main character energy, very "I hold the truth in one place."

and what are those leap seconds even for? they get used to figure out the proper end time of a record (and consequently a trace). so yeah, kind of a big deal.

⚠️ heads up: the way that using this facility causes the leap second indication in the fixed section data header to be ignored?? yeah. no cap. it just gets ignored. 🫢

now let's break down the two girlies:

  • ms_readleapseconds takes an environment variable name, and that env var is expected to contain the name of a leap seconds file. so it's like, env var β†’ filename β†’ leap seconds. a little relay race. πŸƒβ€β™€οΈ
  • ms_readleapsecondfile takes the name of a leap second file directly. no middleman. straight to the source. periodt.

🌈 LEAP SECOND LIST FILE 🌈

so what does this file actually look like? it's expected to contain a list of leap second times and TAI-UTC difference values. two columns, two jobs:

  • first column β†’ time stamps as seconds since the NTP epoch (Jan. 1 1900)
  • second column β†’ an integer number of seconds that specify the difference between TAI and UTC

usually the most recent version of this file is available here: https://www.ietf.org/timezones/data/leap-seconds.list

go get it bestie, it's giving fresh data 🌸


πŸ¦‹ RETURN VALUES πŸ¦‹

okay so the vibes check out on returns too, let's be precise:

ms_readleapseconds returns:

  • the number of leap seconds read on success ✨
  • -1 on file read errors 😭
  • -2 when the environment variable is not set πŸ’€

ms_readleapsecondfile returns:

  • the number of leap seconds read on success ✨
  • -1 on errors 😭

πŸ‘‘ AUTHOR πŸ‘‘

Chad Trabant IRIS Data Management Center


and that's the whole page, bestie!! this libmseed API page is dated 2016/10/01, and honestly? still slaying. read your leap seconds, respect the global list, and never forget that the fixed section data header leap second indication is getting ignored. iykyk πŸ’œβœ¨πŸŽ€