## Common functions Common functions — Common utility functions |

## Functions

#define | PK_CHECK_VERSION()
gchar ** | pk_ptr_array_to_strv ()
gchar * | pk_iso8601_present ()
gchar * | pk_iso8601_from_date ()
GDate * | pk_iso8601_to_date ()
GDateTime * | pk_iso8601_to_datetime ()
gchar * | pk_get_distro_id ()

## Types and Values

#define | PK_MAJOR_VERSION
#define | PK_MINOR_VERSION
#define | PK_MICRO_VERSION
#define | PK_DBUS_SERVICE
#define | PK_DBUS_PATH
#define | PK_DBUS_INTERFACE
#define | PK_DBUS_INTERFACE_TRANSACTION
#define | PK_DBUS_INTERFACE_OFFLINE
#define | PK_SYSTEM_PACKAGE_LIST_FILENAME
#define | PK_SYSTEM_PACKAGE_CACHE_FILENAME

## Description

This file contains functions that may be useful.

## Functions

### PK_CHECK_VERSION()

    #define             PK_CHECK_VERSION(major,minor,micro)

### pk_ptr_array_to_strv ()

    gchar **
    pk_ptr_array_to_strv (GPtrArray *array);

Form a composite string array of strings. The data in the GPtrArray is copied.

#### Parameters

array | the GPtrArray of strings. | [element-type utf8]

#### Returns

the string array, or `NULL` if invalid.

[transfer full][array zero-terminated=1]

Since: 0.5.2

### pk_iso8601_present ()

    gchar *
    pk_iso8601_present (void);

Get the current date / time as an ISO8601 string.

#### Returns

The current iso8601 date and time

Since: 0.5.2

### pk_iso8601_from_date ()

    gchar *
    pk_iso8601_from_date (const GDate *date);

Convert a date into an ISO8601 data string.

#### Parameters

date | a GDate to convert |

#### Returns

If valid then a new ISO8601 date, else `NULL`

Since: 0.5.2

### pk_iso8601_to_date ()

    GDate *
    pk_iso8601_to_date (const gchar *iso_date);

Convert an ISO8601 date string to a GDate.

[skip]

#### Parameters

iso_date | The ISO8601 date to convert |

#### Returns

If valid then a new `GDate`, else NULL

Since: 0.5.2

### pk_iso8601_to_datetime ()

    GDateTime *
    pk_iso8601_to_datetime (const gchar *iso_date);

Convert an ISO8601 date string to a GDateTime.

[skip]

#### Parameters

iso_date | The ISO8601 date to convert |

#### Returns

If valid then a new `GDateTime`, else NULL

Since: 0.8.11

### pk_get_distro_id ()

    gchar *
    pk_get_distro_id (void);

Get the distribution ID for the current host, typically "distro;version;arch"

#### Returns

a distribution ID

## Types and Values

### PK_MAJOR_VERSION

    #define PK_MAJOR_VERSION				(1)

### PK_MINOR_VERSION

    #define PK_MINOR_VERSION				(1)

### PK_MICRO_VERSION

    #define PK_MICRO_VERSION				(12)

### PK_DBUS_SERVICE

    #define PK_DBUS_SERVICE			"org.freedesktop.PackageKit"

The DBUS name for the PackageKit system service.

### PK_DBUS_PATH

    #define PK_DBUS_PATH			"/org/freedesktop/PackageKit"

The DBUS path to the PackageKit service.

### PK_DBUS_INTERFACE

    #define PK_DBUS_INTERFACE		"org.freedesktop.PackageKit"

The DBUS interface used by the PackageKit service.

### PK_DBUS_INTERFACE_TRANSACTION

    #define PK_DBUS_INTERFACE_TRANSACTION "org.freedesktop.PackageKit.Transaction"

The DBUS interface for PackageKit transactions.

### PK_DBUS_INTERFACE_OFFLINE

    #define PK_DBUS_INTERFACE_OFFLINE "org.freedesktop.PackageKit.Offline"

The DBUS interface for PackageKit offline update functionality

### PK_SYSTEM_PACKAGE_LIST_FILENAME

    #define PK_SYSTEM_PACKAGE_LIST_FILENAME "/var/lib/PackageKit/system.package-list"

### PK_SYSTEM_PACKAGE_CACHE_FILENAME

    #define PK_SYSTEM_PACKAGE_CACHE_FILENAME "/var/lib/PackageKit/package-cache.db"