# GstTestClock

GstTestClock is an implementation of GstClock which has different behaviour compared to GstSystemClock. Time for GstSystemClock advances according to the system time, while time for GstTestClock changes only when gst_test_clock_set_time or gst_test_clock_advance_time are called. GstTestClock provides unit tests with the possibility to precisely advance the time in a deterministic manner, independent of the system time or any other external factors.

## Advancing the time of a GstTestClock

       #include <gst/gst.h>
       #include <gst/check/gsttestclock.h>

       GstClock *clock;
       GstTestClock *test_clock;

       clock = gst_test_clock_new ();
       test_clock = GST_TEST_CLOCK (clock);
       GST_INFO ("Time: %" GST_TIME_FORMAT, GST_TIME_ARGS (gst_clock_get_time (clock)));
       gst_test_clock_advance_time ( test_clock, 1 * GST_SECOND);
       GST_INFO ("Time: %" GST_TIME_FORMAT, GST_TIME_ARGS (gst_clock_get_time (clock)));
       g_usleep (10 * G_USEC_PER_SEC);
       GST_INFO ("Time: %" GST_TIME_FORMAT, GST_TIME_ARGS (gst_clock_get_time (clock)));
       gst_test_clock_set_time (test_clock, 42 * GST_SECOND);
       GST_INFO ("Time: %" GST_TIME_FORMAT, GST_TIME_ARGS (gst_clock_get_time (clock)));
       ...

GstClock allows for setting up single shot or periodic clock notifications as well as waiting for these notifications synchronously (using gst_clock_id_wait) or asynchronously (using gst_clock_id_wait_async or gst_clock_id_wait_async). This is used by many GStreamer elements, among them GstBaseSrc and GstBaseSink.

GstTestClock keeps track of these clock notifications. By calling gst_test_clock_wait_for_next_pending_id or gst_test_clock_wait_for_multiple_pending_ids a unit tests may wait for the next one or several clock notifications to be requested. Additionally unit tests may release blocked waits in a controlled fashion by calling gst_test_clock_process_next_clock_id. This way a unit test can control the inaccuracy (jitter) of clock notifications, since the test can decide to release blocked waits when the clock time has advanced exactly to, or past, the requested clock notification time.

There are also interfaces for determining if a notification belongs to a GstTestClock or not, as well as getting the number of requested clock notifications so far.

N.B.: When a unit test waits for a certain amount of clock notifications to be requested in gst_test_clock_wait_for_next_pending_id or gst_test_clock_wait_for_multiple_pending_ids then these functions may block for a long time. If they block forever then the expected clock notifications were never requested from GstTestClock, and so the assumptions in the code of the unit test are wrong. The unit test case runner in gstcheck is expected to catch these cases either by the default test case timeout or the one set for the unit test by calling tcase_set_timeout().

The sample code below assumes that the element under test will delay a buffer pushed on the source pad by some latency until it arrives on the sink pad. Moreover it is assumed that the element will at some point call gst_clock_id_wait to synchronously wait for a specific time. The first buffer sent will arrive exactly on time only delayed by the latency. The second buffer will arrive a little late (7ms) due to simulated jitter in the clock notification.

## Demonstration of how to work with clock notifications and GstTestClock

       #include <gst/gst.h>
       #include <gst/check/gstcheck.h>
       #include <gst/check/gsttestclock.h>

       GstClockTime latency;
       GstElement *element;
       GstPad *srcpad;
       GstClock *clock;
       GstTestClock *test_clock;
       GstBuffer buf;
       GstClockID pending_id;
       GstClockID processed_id;

       latency = 42 * GST_MSECOND;
       element = create_element (latency, ...);
       srcpad = get_source_pad (element);

       clock = gst_test_clock_new ();
       test_clock = GST_TEST_CLOCK (clock);
       gst_element_set_clock (element, clock);

       GST_INFO ("Set time, create and push the first buffer\n");
       gst_test_clock_set_time (test_clock, 0);
       buf = create_test_buffer (gst_clock_get_time (clock), ...);
       gst_assert_cmpint (gst_pad_push (srcpad, buf), ==, GST_FLOW_OK);

       GST_INFO ("Block until element is waiting for a clock notification\n");
       gst_test_clock_wait_for_next_pending_id (test_clock, &pending_id);
       GST_INFO ("Advance to the requested time of the clock notification\n");
       gst_test_clock_advance_time (test_clock, latency);
       GST_INFO ("Release the next blocking wait and make sure it is the one from element\n");
       processed_id = gst_test_clock_process_next_clock_id (test_clock);
       g_assert (processed_id == pending_id);
       g_assert_cmpint (GST_CLOCK_ENTRY_STATUS (processed_id), ==, GST_CLOCK_OK);
       gst_clock_id_unref (pending_id);
       gst_clock_id_unref (processed_id);

       GST_INFO ("Validate that element produced an output buffer and check its timestamp\n");
       g_assert_cmpint (get_number_of_output_buffer (...), ==, 1);
       buf = get_buffer_pushed_by_element (element, ...);
       g_assert_cmpint (GST_BUFFER_TIMESTAMP (buf), ==, latency);
       gst_buffer_unref (buf);
       GST_INFO ("Check that element does not wait for any clock notification\n");
       g_assert (!gst_test_clock_peek_next_pending_id (test_clock, NULL));

       GST_INFO ("Set time, create and push the second buffer\n");
       gst_test_clock_advance_time (test_clock, 10 * GST_SECOND);
       buf = create_test_buffer (gst_clock_get_time (clock), ...);
       gst_assert_cmpint (gst_pad_push (srcpad, buf), ==, GST_FLOW_OK);

       GST_INFO ("Block until element is waiting for a new clock notification\n");
       (gst_test_clock_wait_for_next_pending_id (test_clock, &pending_id);
       GST_INFO ("Advance past 7ms beyond the requested time of the clock notification\n");
       gst_test_clock_advance_time (test_clock, latency + 7 * GST_MSECOND);
       GST_INFO ("Release the next blocking wait and make sure it is the one from element\n");
       processed_id = gst_test_clock_process_next_clock_id (test_clock);
       g_assert (processed_id == pending_id);
       g_assert_cmpint (GST_CLOCK_ENTRY_STATUS (processed_id), ==, GST_CLOCK_OK);
       gst_clock_id_unref (pending_id);
       gst_clock_id_unref (processed_id);

       GST_INFO ("Validate that element produced an output buffer and check its timestamp\n");
       g_assert_cmpint (get_number_of_output_buffer (...), ==, 1);
       buf = get_buffer_pushed_by_element (element, ...);
       g_assert_cmpint (GST_BUFFER_TIMESTAMP (buf), ==,
           10 * GST_SECOND + latency + 7 * GST_MSECOND);
       gst_buffer_unref (buf);
       GST_INFO ("Check that element does not wait for any clock notification\n");
       g_assert (!gst_test_clock_peek_next_pending_id (test_clock, NULL));
       ...

Since GstTestClock is only supposed to be used in unit tests it calls g_assert, g_assert_cmpint or g_assert_cmpuint to validate all function arguments. This will highlight any issues with the unit test code itself.

## GstTestClock

    GObject
        ╰──GInitiallyUnowned
            ╰──GstObject
                ╰──GstClock
                    ╰──GstTestClock

A GstTestClock structure which is based on a GstClock along with some private data.

### Members

`parent` (GstClock) –
No description available

Since : 1.2

### Class structure

#### GstTestClockClass

The class of a GstTestClock, which has no virtual methods to override.

##### Fields

`parent_class` (GstClockClass) –

the parent class structure

Since : 1.2

### GstCheck.TestClockClass

The class of a GstCheck.TestClock, which has no virtual methods to override.

##### Attributes

`parent_class` (Gst.ClockClass) –

the parent class structure

Since : 1.2

### GstCheck.TestClockClass

The class of a GstCheck.TestClock, which has no virtual methods to override.

##### Attributes

`parent_class` (Gst.ClockClass) –

the parent class structure

Since : 1.2

## GstCheck.TestClock

    GObject.Object
        ╰──GObject.InitiallyUnowned
            ╰──Gst.Object
                ╰──Gst.Clock
                    ╰──GstCheck.TestClock

A GstCheck.TestClock structure which is based on a Gst.Clock along with some private data.

### Members

`parent` (Gst.Clock) –
No description available

Since : 1.2

## GstCheck.TestClock

    GObject.Object
        ╰──GObject.InitiallyUnowned
            ╰──Gst.Object
                ╰──Gst.Clock
                    ╰──GstCheck.TestClock

A GstCheck.TestClock structure which is based on a Gst.Clock along with some private data.

### Members

`parent` (Gst.Clock) –
No description available

Since : 1.2

### Constructors

#### gst_test_clock_new

    GstClock *
    gst_test_clock_new ()

Creates a new test clock with its time set to zero.

MT safe.

Returns ( [transfer: full]) –

a GstTestClock cast to GstClock.

Since : 1.2

#### GstCheck.TestClock.prototype.new

    function GstCheck.TestClock.prototype.new(): {
        // javascript wrapper for 'gst_test_clock_new'
    }

Creates a new test clock with its time set to zero.

MT safe.

Returns (Gst.Clock) –

a GstCheck.TestClock cast to Gst.Clock.

Since : 1.2

#### GstCheck.TestClock.new

    def GstCheck.TestClock.new ():
        #python wrapper for 'gst_test_clock_new'

Creates a new test clock with its time set to zero.

MT safe.

Returns (Gst.Clock) –

a GstCheck.TestClock cast to Gst.Clock.

Since : 1.2

#### gst_test_clock_new_with_start_time

    GstClock *
    gst_test_clock_new_with_start_time (GstClockTime start_time)

Creates a new test clock with its time set to the specified time.

MT safe.

Parameters:

`start_time` –

a GstClockTime set to the desired start time of the clock.

Returns ( [transfer: full]) –

a GstTestClock cast to GstClock.

Since : 1.2

#### GstCheck.TestClock.prototype.new_with_start_time

    function GstCheck.TestClock.prototype.new_with_start_time(start_time: Number): {
        // javascript wrapper for 'gst_test_clock_new_with_start_time'
    }

Creates a new test clock with its time set to the specified time.

MT safe.

Parameters:

`start_time` (Number) –

a Number set to the desired start time of the clock.

Returns (Gst.Clock) –

a GstCheck.TestClock cast to Gst.Clock.

Since : 1.2

#### GstCheck.TestClock.new_with_start_time

    def GstCheck.TestClock.new_with_start_time (start_time):
        #python wrapper for 'gst_test_clock_new_with_start_time'

Creates a new test clock with its time set to the specified time.

MT safe.

Parameters:

`start_time` (int) –

a int set to the desired start time of the clock.

Returns (Gst.Clock) –

a GstCheck.TestClock cast to Gst.Clock.

Since : 1.2

### Methods

#### gst_test_clock_advance_time

    gst_test_clock_advance_time (GstTestClock * test_clock,
                                 GstClockTimeDiff delta)

Advances the time of the test_clock by the amount given by delta. The time of test_clock is monotonically increasing, therefore providing a delta which is negative or zero is a programming error.

MT safe.

Parameters:

`test_clock` –

a GstTestClock for which to increase the time

`delta` –

a positive GstClockTimeDiff to be added to the time of the clock

Since : 1.2

#### GstCheck.TestClock.prototype.advance_time

    function GstCheck.TestClock.prototype.advance_time(delta: Number): {
        // javascript wrapper for 'gst_test_clock_advance_time'
    }

Advances the time of the test_clock by the amount given by delta. The time of test_clock is monotonically increasing, therefore providing a delta which is negative or zero is a programming error.

MT safe.

Parameters:

`test_clock` (GstCheck.TestClock) –

a GstCheck.TestClock for which to increase the time

`delta` (Number) –

a positive Number to be added to the time of the clock

Since : 1.2

#### GstCheck.TestClock.advance_time

    def GstCheck.TestClock.advance_time (self, delta):
        #python wrapper for 'gst_test_clock_advance_time'

Advances the time of the test_clock by the amount given by delta. The time of test_clock is monotonically increasing, therefore providing a delta which is negative or zero is a programming error.

MT safe.

Parameters:

`test_clock` (GstCheck.TestClock) –

a GstCheck.TestClock for which to increase the time

`delta` (int) –

a positive int to be added to the time of the clock

Since : 1.2

#### gst_test_clock_crank

    gboolean
    gst_test_clock_crank (GstTestClock * test_clock)

A "crank" consists of three steps: 1: Wait for a GstClockID to be registered with the GstTestClock. 2: Advance the GstTestClock to the time the GstClockID is waiting, unless the clock time is already passed the clock id (Since: 1.18). 3: Release the GstClockID wait. A "crank" can be though of as the notion of manually driving the clock forward to its next logical step.

Return: TRUE if the crank was successful, FALSE otherwise.

MT safe.

Parameters:

`test_clock` –

GstTestClock to crank

Returns –
No description available

Since : 1.8

#### GstCheck.TestClock.prototype.crank

    function GstCheck.TestClock.prototype.crank(): {
        // javascript wrapper for 'gst_test_clock_crank'
    }

A "crank" consists of three steps: 1: Wait for a Object to be registered with the GstCheck.TestClock. 2: Advance the GstCheck.TestClock to the time the Object is waiting, unless the clock time is already passed the clock id (Since: 1.18). 3: Release the Object wait. A "crank" can be though of as the notion of manually driving the clock forward to its next logical step.

Return: true if the crank was successful, false otherwise.

MT safe.

Parameters:

`test_clock` (GstCheck.TestClock) –

GstCheck.TestClock to crank

Returns (Number) –
No description available

Since : 1.8

#### GstCheck.TestClock.crank

    def GstCheck.TestClock.crank (self):
        #python wrapper for 'gst_test_clock_crank'

A "crank" consists of three steps: 1: Wait for a object to be registered with the GstCheck.TestClock. 2: Advance the GstCheck.TestClock to the time the object is waiting, unless the clock time is already passed the clock id (Since: 1.18). 3: Release the object wait. A "crank" can be though of as the notion of manually driving the clock forward to its next logical step.

Return: True if the crank was successful, False otherwise.

MT safe.

Parameters:

`test_clock` (GstCheck.TestClock) –

GstCheck.TestClock to crank

Returns (bool) –
No description available

Since : 1.8

#### gst_test_clock_get_next_entry_time

    GstClockTime
    gst_test_clock_get_next_entry_time (GstTestClock * test_clock)

Retrieve the requested time for the next pending clock notification.

MT safe.

Parameters:

`test_clock` –

a GstTestClock to fetch the next clock notification time for

Returns –

a GstClockTime set to the time of the next pending clock notification. If no clock notifications have been requested GST_CLOCK_TIME_NONE will be returned.

Since : 1.2

#### GstCheck.TestClock.prototype.get_next_entry_time

    function GstCheck.TestClock.prototype.get_next_entry_time(): {
        // javascript wrapper for 'gst_test_clock_get_next_entry_time'
    }

Retrieve the requested time for the next pending clock notification.

MT safe.

Parameters:

`test_clock` (GstCheck.TestClock) –

a GstCheck.TestClock to fetch the next clock notification time for

Returns (Number) –

a Number set to the time of the next pending clock notification. If no clock notifications have been requested Gst.CLOCK_TIME_NONE will be returned.

Since : 1.2

#### GstCheck.TestClock.get_next_entry_time

    def GstCheck.TestClock.get_next_entry_time (self):
        #python wrapper for 'gst_test_clock_get_next_entry_time'

Retrieve the requested time for the next pending clock notification.

MT safe.

Parameters:

`test_clock` (GstCheck.TestClock) –

a GstCheck.TestClock to fetch the next clock notification time for

Returns (int) –

a int set to the time of the next pending clock notification. If no clock notifications have been requested Gst.CLOCK_TIME_NONE will be returned.

Since : 1.2

#### gst_test_clock_has_id

    gboolean
    gst_test_clock_has_id (GstTestClock * test_clock,
                           GstClockID id)

Checks whether test_clock was requested to provide the clock notification given by id.

MT safe.

Parameters:

`test_clock` –

a GstTestClock to ask if it provided the notification

`id` ( [transfer: none]) –

a GstClockID clock notification

Returns –

TRUE if the clock has been asked to provide the given clock notification, FALSE otherwise.

Since : 1.2

#### GstCheck.TestClock.prototype.has_id

    function GstCheck.TestClock.prototype.has_id(id: Object): {
        // javascript wrapper for 'gst_test_clock_has_id'
    }

Checks whether test_clock was requested to provide the clock notification given by id.

MT safe.

Parameters:

`test_clock` (GstCheck.TestClock) –

a GstCheck.TestClock to ask if it provided the notification

`id` (Object) –

a Object clock notification

Returns (Number) –

true if the clock has been asked to provide the given clock notification, false otherwise.

Since : 1.2

#### GstCheck.TestClock.has_id

    def GstCheck.TestClock.has_id (self, id):
        #python wrapper for 'gst_test_clock_has_id'

Checks whether test_clock was requested to provide the clock notification given by id.

MT safe.

Parameters:

`test_clock` (GstCheck.TestClock) –

a GstCheck.TestClock to ask if it provided the notification

`id` (object) –

a object clock notification

Returns (bool) –

True if the clock has been asked to provide the given clock notification, False otherwise.

Since : 1.2

#### gst_test_clock_peek_id_count

    guint
    gst_test_clock_peek_id_count (GstTestClock * test_clock)

Determine the number of pending clock notifications that have been requested from the test_clock.

MT safe.

Parameters:

`test_clock` –

a GstTestClock for which to count notifications

Returns –

the number of pending clock notifications.

Since : 1.2

#### GstCheck.TestClock.prototype.peek_id_count

    function GstCheck.TestClock.prototype.peek_id_count(): {
        // javascript wrapper for 'gst_test_clock_peek_id_count'
    }

Determine the number of pending clock notifications that have been requested from the test_clock.

MT safe.

Parameters:

`test_clock` (GstCheck.TestClock) –

a GstCheck.TestClock for which to count notifications

Returns (Number) –

the number of pending clock notifications.

Since : 1.2

#### GstCheck.TestClock.peek_id_count

    def GstCheck.TestClock.peek_id_count (self):
        #python wrapper for 'gst_test_clock_peek_id_count'

Determine the number of pending clock notifications that have been requested from the test_clock.

MT safe.

Parameters:

`test_clock` (GstCheck.TestClock) –

a GstCheck.TestClock for which to count notifications

Returns (int) –

the number of pending clock notifications.

Since : 1.2

#### gst_test_clock_peek_next_pending_id

    gboolean
    gst_test_clock_peek_next_pending_id (GstTestClock * test_clock,
                                         GstClockID * pending_id)

Determines if the pending_id is the next clock notification scheduled to be triggered given the current time of the test_clock.

MT safe.

Return: TRUE if pending_id is the next clock notification to be triggered, FALSE otherwise.

Parameters:

`test_clock` –

a GstTestClock to check the clock notifications for

`pending_id` ( [allow-none][out][transfer: full]) –

a GstClockID clock notification to look for

Returns –
No description available

Since : 1.2

#### GstCheck.TestClock.prototype.peek_next_pending_id

    function GstCheck.TestClock.prototype.peek_next_pending_id(): {
        // javascript wrapper for 'gst_test_clock_peek_next_pending_id'
    }

Determines if the pending_id is the next clock notification scheduled to be triggered given the current time of the test_clock.

MT safe.

Return: true if pending_id is the next clock notification to be triggered, false otherwise.

Parameters:

`test_clock` (GstCheck.TestClock) –

a GstCheck.TestClock to check the clock notifications for

Returns a tuple made of:

(Number ) –
No description available
`pending_id` (Object ) –
No description available

Since : 1.2

#### GstCheck.TestClock.peek_next_pending_id

    def GstCheck.TestClock.peek_next_pending_id (self):
        #python wrapper for 'gst_test_clock_peek_next_pending_id'

Determines if the pending_id is the next clock notification scheduled to be triggered given the current time of the test_clock.

MT safe.

Return: True if pending_id is the next clock notification to be triggered, False otherwise.

Parameters:

`test_clock` (GstCheck.TestClock) –

a GstCheck.TestClock to check the clock notifications for

Returns a tuple made of:

(bool ) –
No description available
`pending_id` (object ) –
No description available

Since : 1.2

#### gst_test_clock_process_id

    gboolean
    gst_test_clock_process_id (GstTestClock * test_clock,
                               GstClockID pending_id)

Processes and releases the pending ID.

MT safe.

Parameters:

`test_clock` –

GstTestClock for which to process the pending IDs

`pending_id` ( [transfer: full]) –

GstClockID

Returns –
No description available

Since : 1.18

#### GstCheck.TestClock.prototype.process_id

    function GstCheck.TestClock.prototype.process_id(pending_id: Object): {
        // javascript wrapper for 'gst_test_clock_process_id'
    }

Processes and releases the pending ID.

MT safe.

Parameters:

`test_clock` (GstCheck.TestClock) –

GstCheck.TestClock for which to process the pending IDs

`pending_id` (Object) –

Object

Returns (Number) –
No description available

Since : 1.18

#### GstCheck.TestClock.process_id

    def GstCheck.TestClock.process_id (self, pending_id):
        #python wrapper for 'gst_test_clock_process_id'

Processes and releases the pending ID.

MT safe.

Parameters:

`test_clock` (GstCheck.TestClock) –

GstCheck.TestClock for which to process the pending IDs

`pending_id` (object) –

object

Returns (bool) –
No description available

Since : 1.18

#### gst_test_clock_process_id_list

    guint
    gst_test_clock_process_id_list (GstTestClock * test_clock,
                                    const GList * pending_list)

Processes and releases the pending IDs in the list.

MT safe.

Parameters:

`test_clock` –

GstTestClock for which to process the pending IDs

`pending_list` ( [element-typeGst.ClockID][transfer: none][allow-none]) –

List of pending GstClockID

Returns –
No description available

Since : 1.4

#### GstCheck.TestClock.prototype.process_id_list

    function GstCheck.TestClock.prototype.process_id_list(pending_list: [ Object ]): {
        // javascript wrapper for 'gst_test_clock_process_id_list'
    }

Processes and releases the pending IDs in the list.

MT safe.

Parameters:

`test_clock` (GstCheck.TestClock) –

GstCheck.TestClock for which to process the pending IDs

`pending_list` ([ Object ]) –

List of pending Object

Returns (Number) –
No description available

Since : 1.4

#### GstCheck.TestClock.process_id_list

    def GstCheck.TestClock.process_id_list (self, pending_list):
        #python wrapper for 'gst_test_clock_process_id_list'

Processes and releases the pending IDs in the list.

MT safe.

Parameters:

`test_clock` (GstCheck.TestClock) –

GstCheck.TestClock for which to process the pending IDs

`pending_list` ([ object ]) –

List of pending object

Returns (int) –
No description available

Since : 1.4

#### gst_test_clock_process_next_clock_id

    GstClockID
    gst_test_clock_process_next_clock_id (GstTestClock * test_clock)

MT safe.

Parameters:

`test_clock` –

a GstTestClock for which to retrieve the next pending clock notification

Returns ( [transfer: full][nullable]) –

a GstClockID containing the next pending clock notification.

Since : 1.2

#### GstCheck.TestClock.prototype.process_next_clock_id

    function GstCheck.TestClock.prototype.process_next_clock_id(): {
        // javascript wrapper for 'gst_test_clock_process_next_clock_id'
    }

MT safe.

Parameters:

`test_clock` (GstCheck.TestClock) –

a GstCheck.TestClock for which to retrieve the next pending clock notification

Returns (Object) –

a Object containing the next pending clock notification.

Since : 1.2

#### GstCheck.TestClock.process_next_clock_id

    def GstCheck.TestClock.process_next_clock_id (self):
        #python wrapper for 'gst_test_clock_process_next_clock_id'

MT safe.

Parameters:

`test_clock` (GstCheck.TestClock) –

a GstCheck.TestClock for which to retrieve the next pending clock notification

Returns (object) –

a object containing the next pending clock notification.

Since : 1.2

#### gst_test_clock_set_time

    gst_test_clock_set_time (GstTestClock * test_clock,
                             GstClockTime new_time)

Sets the time of test_clock to the time given by new_time. The time of test_clock is monotonically increasing, therefore providing a new_time which is earlier or equal to the time of the clock as given by gst_clock_get_time is a programming error.

MT safe.

Parameters:

`test_clock` –

a GstTestClock of which to set the time

`new_time` –

a GstClockTime later than that returned by gst_clock_get_time

Since : 1.2

#### GstCheck.TestClock.prototype.set_time

    function GstCheck.TestClock.prototype.set_time(new_time: Number): {
        // javascript wrapper for 'gst_test_clock_set_time'
    }

Sets the time of test_clock to the time given by new_time. The time of test_clock is monotonically increasing, therefore providing a new_time which is earlier or equal to the time of the clock as given by Gst.Clock.prototype.get_time is a programming error.

MT safe.

Parameters:

`test_clock` (GstCheck.TestClock) –

a GstCheck.TestClock of which to set the time

`new_time` (Number) –

a Number later than that returned by Gst.Clock.prototype.get_time

Since : 1.2

#### GstCheck.TestClock.set_time

    def GstCheck.TestClock.set_time (self, new_time):
        #python wrapper for 'gst_test_clock_set_time'

Sets the time of test_clock to the time given by new_time. The time of test_clock is monotonically increasing, therefore providing a new_time which is earlier or equal to the time of the clock as given by Gst.Clock.get_time is a programming error.

MT safe.

Parameters:

`test_clock` (GstCheck.TestClock) –

a GstCheck.TestClock of which to set the time

`new_time` (int) –

a int later than that returned by Gst.Clock.get_time

Since : 1.2

#### gst_test_clock_timed_wait_for_multiple_pending_ids

    gboolean
    gst_test_clock_timed_wait_for_multiple_pending_ids (GstTestClock * test_clock,
                                                        guint count,
                                                        guint timeout_ms,
                                                        GList ** pending_list)

Blocks until at least count clock notifications have been requested from test_clock, or the timeout expires.

MT safe.

Parameters:

`test_clock` –

GstTestClock for which to await having enough pending clock

`count` –

the number of pending clock notifications to wait for

`timeout_ms` –

the timeout in milliseconds

`pending_list` ( [out][element-typeGst.ClockID][transfer: full][allow-none]) –

Address of a GList pointer variable to store the list of pending GstClockID that expired, or NULL

Returns –

a gboolean TRUE if the waits have been registered, FALSE if not. (Could be that it timed out waiting or that more waits than waits was found)

Since : 1.16

#### GstCheck.TestClock.prototype.timed_wait_for_multiple_pending_ids

    function GstCheck.TestClock.prototype.timed_wait_for_multiple_pending_ids(count: Number, timeout_ms: Number): {
        // javascript wrapper for 'gst_test_clock_timed_wait_for_multiple_pending_ids'
    }

Blocks until at least count clock notifications have been requested from test_clock, or the timeout expires.

MT safe.

Parameters:

`test_clock` (GstCheck.TestClock) –

GstCheck.TestClock for which to await having enough pending clock

`count` (Number) –

the number of pending clock notifications to wait for

`timeout_ms` (Number) –

the timeout in milliseconds

Returns a tuple made of:

(Number ) –

a gboolean true if the waits have been registered, false if not. (Could be that it timed out waiting or that more waits than waits was found)

`pending_list` ([ Object ] ) –

a gboolean true if the waits have been registered, false if not. (Could be that it timed out waiting or that more waits than waits was found)

Since : 1.16

#### GstCheck.TestClock.timed_wait_for_multiple_pending_ids

    def GstCheck.TestClock.timed_wait_for_multiple_pending_ids (self, count, timeout_ms):
        #python wrapper for 'gst_test_clock_timed_wait_for_multiple_pending_ids'

Blocks until at least count clock notifications have been requested from test_clock, or the timeout expires.

MT safe.

Parameters:

`test_clock` (GstCheck.TestClock) –

GstCheck.TestClock for which to await having enough pending clock

`count` (int) –

the number of pending clock notifications to wait for

`timeout_ms` (int) –

the timeout in milliseconds

Returns a tuple made of:

(bool ) –

a gboolean True if the waits have been registered, False if not. (Could be that it timed out waiting or that more waits than waits was found)

`pending_list` ([ object ] ) –

a gboolean True if the waits have been registered, False if not. (Could be that it timed out waiting or that more waits than waits was found)

Since : 1.16

#### gst_test_clock_wait_for_multiple_pending_ids

    gst_test_clock_wait_for_multiple_pending_ids (GstTestClock * test_clock,
                                                  guint count,
                                                  GList ** pending_list)

Blocks until at least count clock notifications have been requested from test_clock. There is no timeout for this wait, see the main description of GstTestClock.

MT safe.

Parameters:

`test_clock` –

GstTestClock for which to await having enough pending clock

`count` –

the number of pending clock notifications to wait for

`pending_list` ( [out][element-typeGst.ClockID][transfer: full][allow-none]) –

Address of a GList pointer variable to store the list of pending GstClockID that expired, or NULL

Since : 1.4

#### GstCheck.TestClock.prototype.wait_for_multiple_pending_ids

    function GstCheck.TestClock.prototype.wait_for_multiple_pending_ids(count: Number): {
        // javascript wrapper for 'gst_test_clock_wait_for_multiple_pending_ids'
    }

Blocks until at least count clock notifications have been requested from test_clock. There is no timeout for this wait, see the main description of GstCheck.TestClock.

MT safe.

Parameters:

`test_clock` (GstCheck.TestClock) –

GstCheck.TestClock for which to await having enough pending clock

`count` (Number) –

the number of pending clock notifications to wait for

Since : 1.4

#### GstCheck.TestClock.wait_for_multiple_pending_ids

    def GstCheck.TestClock.wait_for_multiple_pending_ids (self, count):
        #python wrapper for 'gst_test_clock_wait_for_multiple_pending_ids'

Blocks until at least count clock notifications have been requested from test_clock. There is no timeout for this wait, see the main description of GstCheck.TestClock.

MT safe.

Parameters:

`test_clock` (GstCheck.TestClock) –

GstCheck.TestClock for which to await having enough pending clock

`count` (int) –

the number of pending clock notifications to wait for

Since : 1.4

#### gst_test_clock_wait_for_next_pending_id

    gst_test_clock_wait_for_next_pending_id (GstTestClock * test_clock,
                                             GstClockID * pending_id)

Waits until a clock notification is requested from test_clock. There is no timeout for this wait, see the main description of GstTestClock. A reference to the pending clock notification is stored in pending_id.

MT safe.

Parameters:

`test_clock` –

GstTestClock for which to get the pending clock notification

`pending_id` ( [allow-none][out][transfer: full]) –

GstClockID with information about the pending clock notification

Since : 1.2

#### GstCheck.TestClock.prototype.wait_for_next_pending_id

    function GstCheck.TestClock.prototype.wait_for_next_pending_id(): {
        // javascript wrapper for 'gst_test_clock_wait_for_next_pending_id'
    }

Waits until a clock notification is requested from test_clock. There is no timeout for this wait, see the main description of GstCheck.TestClock. A reference to the pending clock notification is stored in pending_id.

MT safe.

Parameters:

`test_clock` (GstCheck.TestClock) –

GstCheck.TestClock for which to get the pending clock notification

Since : 1.2

#### GstCheck.TestClock.wait_for_next_pending_id

    def GstCheck.TestClock.wait_for_next_pending_id (self):
        #python wrapper for 'gst_test_clock_wait_for_next_pending_id'

Waits until a clock notification is requested from test_clock. There is no timeout for this wait, see the main description of GstCheck.TestClock. A reference to the pending clock notification is stored in pending_id.

MT safe.

Parameters:

`test_clock` (GstCheck.TestClock) –

GstCheck.TestClock for which to get the pending clock notification

Since : 1.2

#### gst_test_clock_wait_for_pending_id_count

    gst_test_clock_wait_for_pending_id_count (GstTestClock * test_clock,
                                              guint count)

Blocks until at least count clock notifications have been requested from test_clock. There is no timeout for this wait, see the main description of GstTestClock.

Parameters:

`test_clock` –

GstTestClock for which to await having enough pending clock

`count` –

the number of pending clock notifications to wait for

Since : 1.2

deprecated : use gst_test_clock_wait_for_multiple_pending_ids() instead.

#### GstCheck.TestClock.prototype.wait_for_pending_id_count

    function GstCheck.TestClock.prototype.wait_for_pending_id_count(count: Number): {
        // javascript wrapper for 'gst_test_clock_wait_for_pending_id_count'
    }

Blocks until at least count clock notifications have been requested from test_clock. There is no timeout for this wait, see the main description of GstCheck.TestClock.

Parameters:

`test_clock` (GstCheck.TestClock) –

GstCheck.TestClock for which to await having enough pending clock

`count` (Number) –

the number of pending clock notifications to wait for

Since : 1.2

deprecated : use gst_test_clock_wait_for_multiple_pending_ids() instead.

#### GstCheck.TestClock.wait_for_pending_id_count

    def GstCheck.TestClock.wait_for_pending_id_count (self, count):
        #python wrapper for 'gst_test_clock_wait_for_pending_id_count'

Blocks until at least count clock notifications have been requested from test_clock. There is no timeout for this wait, see the main description of GstCheck.TestClock.

Parameters:

`test_clock` (GstCheck.TestClock) –

GstCheck.TestClock for which to await having enough pending clock

`count` (int) –

the number of pending clock notifications to wait for

Since : 1.2

deprecated : use gst_test_clock_wait_for_multiple_pending_ids() instead.

### Functions

#### gst_test_clock_id_list_get_latest_time

    GstClockTime
    gst_test_clock_id_list_get_latest_time (const GList * pending_list)

Finds the latest time inside the list.

MT safe.

Parameters:

`pending_list` ( [element-typeGst.ClockID][transfer: none][allow-none]) –

List of of pending GstClockID

Returns –
No description available

Since : 1.4

#### GstCheck.TestClock.prototype.id_list_get_latest_time

    function GstCheck.TestClock.prototype.id_list_get_latest_time(pending_list: [ Object ]): {
        // javascript wrapper for 'gst_test_clock_id_list_get_latest_time'
    }

Finds the latest time inside the list.

MT safe.

Parameters:

`pending_list` ([ Object ]) –

List of of pending Object

Returns (Number) –
No description available

Since : 1.4

#### GstCheck.TestClock.id_list_get_latest_time

    def GstCheck.TestClock.id_list_get_latest_time (pending_list):
        #python wrapper for 'gst_test_clock_id_list_get_latest_time'

Finds the latest time inside the list.

MT safe.

Parameters:

`pending_list` ([ object ]) –

List of of pending object

Returns (int) –
No description available

Since : 1.4

### Properties

#### clock-type

    “clock-type” GstClockType *

Flags : Read / Write

#### clock-type

    “clock-type” Gst.ClockType

Flags : Read / Write

#### clock_type

    “self.props.clock_type” Gst.ClockType

Flags : Read / Write

#### start-time

    “start-time” guint64

When a GstTestClock is constructed it will have a certain start time set. If the clock was created using gst_test_clock_new_with_start_time then this property contains the value of the start_time argument. If gst_test_clock_new was called the clock started at time zero, and thus this property contains the value 0.

Flags : Read / Write / Construct Only

#### start-time

    “start-time” Number

When a GstCheck.TestClock is constructed it will have a certain start time set. If the clock was created using GstCheck.TestClock.prototype.new_with_start_time then this property contains the value of the start_time argument. If GstCheck.TestClock.prototype.new was called the clock started at time zero, and thus this property contains the value 0.

Flags : Read / Write / Construct Only

#### start_time

    “self.props.start_time” int

When a GstCheck.TestClock is constructed it will have a certain start time set. If the clock was created using GstCheck.TestClock.new_with_start_time then this property contains the value of the start_time argument. If GstCheck.TestClock.new was called the clock started at time zero, and thus this property contains the value 0.

Flags : Read / Write / Construct Only

## Function Macros

### GST_TEST_CLOCK_CAST

    #define GST_TEST_CLOCK_CAST(obj) ((GstTestClock*)(obj))

The results of the search are