### Method

# GLib DateTime to_timeval

deprecated: 2.62 since: 2.26

#### Declaration

    gboolean
    g_date_time_to_timeval (
      GDateTime* datetime,
      GTimeVal* tv
    )

#### Description

Stores the instant in time that `datetime` represents into `tv`.

The time contained in a `GTimeVal` is always stored in the form of seconds elapsed since 1970-01-01 00:00:00 UTC, regardless of the time zone associated with `datetime`.

On systems where ‘long’ is 32bit (ie: all 32bit systems and all Windows systems), a `GTimeVal` is incapable of storing the entire range of values that `GDateTime` is capable of expressing. On those systems, this function returns `FALSE` to indicate that the time is out of range.

On systems where ‘long’ is 64bit, this function never fails.

Available since: 2.26

Deprecated since: 2.62

`GTimeVal` is not year-2038-safe. Use `g_date_time_to_unix()` instead.

#### Parameters

`tv`

  Type: `GTimeVal`

  A `GTimeVal` to modify.

  The data is owned by the caller of the method.

#### Return value

Type: `gboolean`

`TRUE` if successful, else `FALSE`.