### Function

# Gm wakeup_timeout_add_seconds_once

since: 0.3.0

#### Declaration [src]

    guint
    gm_wakeup_timeout_add_seconds_once (
      int seconds,
      GSourceOnceFunc function,
      gpointer data,
      GError** error
    )

#### Description [src]

Sets a function to be called after a timeout with the default priority, `G_PRIORITY_DEFAULT`. Correctly calculates the timeout even when the system is suspended in between. It will wake up the system when needed.

If the process doesn’t have enough permissions to wake the system creating the timer will fail. On Linux at least `CAP_WAKE_ALARM` capabilities are needed.

The timeout given is in terms of `CLOCK_BOOTTIME_ALARM` time, it hence is also correct across suspend and resume. If that doesn’t matter use `g_timeout_add_seconds` instead.

Note that glib’s `g_timeout_add_seconds()` doesn’t take system suspend/resume into account: https://gitlab.gnome.org/GNOME/glib/-/issues/2739.

Available since: 0.3.0

This function is not directly available to language bindings.

The implementation of this function is provided by `gm_wakeup_timeout_add_seconds_once_full()` in language bindings.

#### Parameters

`seconds`

  Type: `int`

  The timeout in seconds.

`function`

  Type: `GSourceOnceFunc`

  Function to call.

`data`

  Type: `gpointer`

  Data to pass to `function`.

  The argument can be `NULL`.
  The data is owned by the caller of the function.

`error`

  Type: `GError **`

  The return location for a recoverable error.

  The argument can be `NULL`.
  If the return location is not `NULL`, then you must initialize it to a `NULL` `GError*`.
  The argument will be left initialized to `NULL` by the function if there are no errors.
  In case of error, the argument will be set to a newly allocated `GError`; the caller will take ownership of the data, and be responsible for freeing it.

#### Return value

Type: `guint`

The ID (greater than 0) of the event source or `0` on error.