GCC Code Coverage Report


Directory: ./
File: panels/system/datetime/tz.h
Date: 2024-05-04 07:58:27
Exec Total Coverage
Lines: 0 1 0.0%
Functions: 0 2 0.0%
Branches: 0 2 0.0%

Line Branch Exec Source
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /* Generic timezone utilities.
3 *
4 * Copyright (C) 2000-2001 Ximian, Inc.
5 *
6 * Authors: Hans Petter Jansson <hpj@ximian.com>
7 *
8 * Largely based on Michael Fulbright's work on Anaconda.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, see <http://www.gnu.org/licenses/>.
22 */
23
24 #pragma once
25
26 #include <glib.h>
27
28 G_BEGIN_DECLS
29
30 #ifndef __sun
31 # define TZ_DATA_FILE "/usr/share/zoneinfo/zone.tab"
32 #else
33 # define TZ_DATA_FILE "/usr/share/lib/zoneinfo/tab/zone_sun.tab"
34 #endif
35
36 typedef struct _TzDB TzDB;
37 typedef struct _TzLocation TzLocation;
38 typedef struct _TzInfo TzInfo;
39
40
41 struct _TzDB
42 {
43 GPtrArray *locations;
44 GHashTable *backward;
45 };
46
47 struct _TzLocation
48 {
49 gchar *country;
50 gdouble latitude;
51 gdouble longitude;
52 gchar *zone;
53 gchar *comment;
54
55 gdouble dist; /* distance to clicked point for comparison */
56 };
57
58 /* see the glibc info page information on time zone information */
59 /* tzname is the default name for the timezone */
60 /* utc_offset is offset in seconds from utc */
61 /* daylight if non-zero then location obeys daylight savings */
62
63 struct _TzInfo
64 {
65 gchar *tzname;
66 glong utc_offset;
67 gint daylight;
68 };
69
70
71 TzDB *tz_load_db (void);
72 void tz_db_free (TzDB *db);
73 char * tz_info_get_clean_name (TzDB *tz_db,
74 const char *tz);
75 GPtrArray *tz_get_locations (TzDB *db);
76 void tz_location_get_position (TzLocation *loc,
77 double *longitude, double *latitude);
78 char *tz_location_get_country (TzLocation *loc);
79 gchar *tz_location_get_zone (TzLocation *loc);
80 gchar *tz_location_get_comment (TzLocation *loc);
81 glong tz_location_get_base_utc_offset (TzLocation *loc);
82 gint tz_location_set_locally (TzLocation *loc);
83 TzInfo *tz_info_from_location (TzLocation *loc);
84 void tz_info_free (TzInfo *tz_info);
85
86
87 G_DEFINE_AUTOPTR_CLEANUP_FUNC (TzDB, tz_db_free)
88 G_DEFINE_AUTOPTR_CLEANUP_FUNC (TzInfo, tz_info_free)
89
90 G_END_DECLS
91