COMEDI_GET_CLOCK_SOU(3)

πŸ’– comedi_get_clock_source β€” get the master clock for a subdevice πŸ’–

okay bestie, welcome to the Comedi reference page for comedi_get_clock_source(3) ✨ (yes, the manual is literally named COMEDI_GET_CLOCK_SOU(3), the terminal just cuts it off, it's giving ctrl-c on the title ngl). Sit down, grab a boba πŸ§‹, and let's find out what clock your subdevice is running on πŸ•πŸ’…


✨ NAME ✨

comedi_get_clock_source β€” get the master clock for a subdevice


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <comedilib.h>

int comedi_get_clock_source(comedi_t * device, unsigned int subdevice,
                            unsigned int channel, unsigned int * clock,
                            unsigned int * period_ns);

πŸŽ€ STATUS πŸŽ€

alpha 🍼 β€” yeah she's still in her alpha era, handle with care-ish, but we love her anyway.


🌸 DESCRIPTION 🌸

So basically πŸ’β€β™€οΈ this function goes and queries the master clock for a subdevice β€” aka the clock that comedi_set_clock_source already set up earlier. Think of it like asking your subdevice "hey girl, what time is it for you?" πŸ•΅οΈβ€β™€οΈ

The master clock that's currently configured gets written to *clock ✍️. And here's the tea: the possible values and what clock each one actually corresponds to are driver-dependant β€” so it depends on which driver you're running, no cap 🚫🧒.

The period of the clock, in nanoseconds, gets written to *period_ns. If that period is unknown, you just get a literal zero 0 in there, and honestly? relatable, sometimes we don't know our own period either 😭🩸

Now, if your subdevice doesn't support configuring its master clocks on a per-channel basis, then the channel parameter just gets ignored. It's giving "I don't see you" energy πŸ™ˆ β€” not personal, it's just how the hardware is set up.

It is safe to pass NULL pointers as the clock or period_ns parameters 🫢 β€” so if you only care about one of them, go off, pass NULL for the other, she won't crash.

⚠️ important vibe check: this function is only useable on subdevices that provide support for the INSN_CONFIG_GET_CLOCK_SRC configuration instruction. If your subdevice doesn't do that, it's not happening bestie πŸ’€

πŸ‘‘ RETURN VALUE πŸ‘‘

  • 0 β€” on success πŸŽ‰ slay, you got your clock
  • -1 β€” on error πŸ˜” something went wrong

πŸ’œ AUTHORS πŸ’œ

The iconic legends who made this happen, we stan 🫢:

  • David Schleef <ds@schleef.org> β€” Author. πŸ‘‘
  • Frank Mori Hess <fmhess@users.sourceforge.net> β€” Author. πŸ‘‘
  • Herman Bruyninckx <Herman.Bruyninckx@mech.kuleuven.ac.be> β€” Author. πŸ‘‘
  • Bernd Porr <tech@linux-usb-daq.co.uk> β€” Author. πŸ‘‘
  • Ian Abbott <abbotti@mev.co.uk> β€” Author. πŸ‘‘
  • Γ‰ric Piel <piel@delmic.com> β€” Author. πŸ‘‘

Copyright Β© 1998-2003 David Schleef Copyright Β© 2001-2003, 2005, 2008 Frank Mori Hess Copyright Β© 2002-2003 Herman Bruyninckx Copyright Β© 2012 Bernd Porr Copyright Β© 2012 Ian Abbott Copyright Β© 2012, 2015 Γ‰ric Piel

This document is part of Comedilib πŸ“š. And quick side note for the legal girlies: in the context of this document, the term "source code" as defined by the license is interpreted as the XML source πŸ—’οΈβœ¨

This library is free software β€” you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, version 2.1 of the License πŸ’–

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY β€” like, literally none. Not even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE πŸ’€. See the GNU Lesser General Public License for more details, bestie, please read it fr fr πŸ“–

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA πŸ“¬πŸ«Ά


aaaaand that's the whole page! πŸ’… This was Comedi, dated 03/20/2026, for the manual page COMEDI_GET_CLOCK_SOU(3) β€” go get those clocks, main character πŸ•πŸ‘‘βœ¨ bye bestie, ily, gn πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from