<chapter id="chapter-clocks">
  <title>Clocks in GStreamer</title>
  <para>
  	Each <classname>GstBin</classname> holds a <classname>GstClock</classname> instance.
	Such an instance can be provided by e.g. <classname>GstSystemClock</classname> or by
	an <classname>GstElement</classname> that is part of the <classname>GstBin</classname>.
	Such a clock is like a stop-watch - it will be started when the bin starts to play
	and will be stopped when the bin gets stopped. Once the clock runs, it can do nice
	things like calling a callback you have registered at regular intervals.
  </para>
  <note>
    <para>
	  The <classname>GstClock</classname> is still very much under construction.
	</para>
  </note>
	  
  <para>
  	The following code snipped demonstrates how to get the current clock of the bin
	and how to show its capabillities:
  </para>

  <para>
    <programlisting>
  GstClock *cur_clock;
  GstElement *my_thread;
  
  ...
  
  cur_clock=gst_bin_get_clock(GST_BIN (my_thread));
  if(cur_clock) {
  	g_printf("current clock can do : 0x%x\n",GST_CLOCK_FLAGS(cur_clock));
  }
  	</programlisting>
</para>

  <para>
  	If the clock does not suit your needs, you need to obtain a instance and set this
	as the active clock of the bin.
  </para>

</chapter>
