GTimeZoneMonitor

GTimeZoneMonitor — Monitor the local timezone

Synopsis

                    GTimeZoneMonitor;
GTimeZoneMonitor *  g_time_zone_monitor_get             (void);

Object Hierarchy

  GObject
   +----GTimeZoneMonitor

Signals

  "changed"                                        : Run First

Description

GTimeZoneMonitor is a utility class to monitor the local timezone for changes (ie: in response to the user manually changing the timezone to that of a different locale).

You must use this class in order for your program to notice changes to the local timezone. It works by monitoring the /etc/localtime file. When the timezone is found to have changed, g_time_zone_refresh_local() is called and the "changed" signal is emitted on the GTimeZoneMonitor (in that order).

Windows support is not presently working.

Details

GTimeZoneMonitor

typedef struct _GTimeZoneMonitor GTimeZoneMonitor;

This is an opaque structure type.


g_time_zone_monitor_get ()

GTimeZoneMonitor *  g_time_zone_monitor_get             (void);

Gets the singleton instance of the GTimeZoneMonitor class, creating it if required.

You should call g_object_unref() on the result when you no longer need it. Be aware, though, that this will not destroy the instance, so if you connected to the changed signal, you are required to disconnect from it for yourself.

There is only one instance of GTimeZoneMonitor and it dispatches its signals via the default GMainContext. There is no way to create an instance that will dispatch signals using a different context.

Returns :

a reference to the GTimeZoneMonitor.

Signal Details

The "changed" signal

void                user_function                      (GTimeZoneMonitor *monitor,
                                                        gpointer          user_data)      : Run First

Indicates that the local timezone has changed.

The g_time_zone_refresh_local() function is called just before this signal is emitted, so any new GTimeZone or GDateTime instances created from signal handlers will be as per the new timezone.

Note that this signal is not emitted in response to entering or exiting daylight savings time within a given timezone. It's only for when the user has changed the timezone to that of a different location.

monitor :

the GTimeZoneMonitor

user_data :

user data set when the signal handler was connected.