Update German translation
[glib.git] / glib / gdatetime.h
blob927e29cfc0239258292bd681eb5358a6078844cb
1 /*
2 * Copyright (C) 2009-2010 Christian Hergert <chris@dronelabs.com>
3 * Copyright © 2010 Codethink Limited
5 * This library is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as
7 * published by the Free Software Foundation; either version 2.1 of the
8 * licence, or (at your option) any later version.
10 * This is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13 * License for more details.
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this library; if not, see <http://www.gnu.org/licenses/>.
18 * Authors: Christian Hergert <chris@dronelabs.com>
19 * Thiago Santos <thiago.sousa.santos@collabora.co.uk>
20 * Emmanuele Bassi <ebassi@linux.intel.com>
21 * Ryan Lortie <desrt@desrt.ca>
24 #ifndef __G_DATE_TIME_H__
25 #define __G_DATE_TIME_H__
27 #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
28 #error "Only <glib.h> can be included directly."
29 #endif
31 #include <glib/gtimezone.h>
33 G_BEGIN_DECLS
35 /**
36 * G_TIME_SPAN_DAY:
38 * Evaluates to a time span of one day.
40 * Since: 2.26
42 #define G_TIME_SPAN_DAY (G_GINT64_CONSTANT (86400000000))
44 /**
45 * G_TIME_SPAN_HOUR:
47 * Evaluates to a time span of one hour.
49 * Since: 2.26
51 #define G_TIME_SPAN_HOUR (G_GINT64_CONSTANT (3600000000))
53 /**
54 * G_TIME_SPAN_MINUTE:
56 * Evaluates to a time span of one minute.
58 * Since: 2.26
60 #define G_TIME_SPAN_MINUTE (G_GINT64_CONSTANT (60000000))
62 /**
63 * G_TIME_SPAN_SECOND:
65 * Evaluates to a time span of one second.
67 * Since: 2.26
69 #define G_TIME_SPAN_SECOND (G_GINT64_CONSTANT (1000000))
71 /**
72 * G_TIME_SPAN_MILLISECOND:
74 * Evaluates to a time span of one millisecond.
76 * Since: 2.26
78 #define G_TIME_SPAN_MILLISECOND (G_GINT64_CONSTANT (1000))
80 /**
81 * GTimeSpan:
83 * A value representing an interval of time, in microseconds.
85 * Since: 2.26
87 typedef gint64 GTimeSpan;
89 /**
90 * GDateTime:
92 * `GDateTime` is an opaque structure whose members
93 * cannot be accessed directly.
95 * Since: 2.26
97 typedef struct _GDateTime GDateTime;
99 GLIB_AVAILABLE_IN_ALL
100 void g_date_time_unref (GDateTime *datetime);
101 GLIB_AVAILABLE_IN_ALL
102 GDateTime * g_date_time_ref (GDateTime *datetime);
104 GLIB_AVAILABLE_IN_ALL
105 GDateTime * g_date_time_new_now (GTimeZone *tz);
106 GLIB_AVAILABLE_IN_ALL
107 GDateTime * g_date_time_new_now_local (void);
108 GLIB_AVAILABLE_IN_ALL
109 GDateTime * g_date_time_new_now_utc (void);
111 GLIB_AVAILABLE_IN_ALL
112 GDateTime * g_date_time_new_from_unix_local (gint64 t);
113 GLIB_AVAILABLE_IN_ALL
114 GDateTime * g_date_time_new_from_unix_utc (gint64 t);
116 GLIB_AVAILABLE_IN_ALL
117 GDateTime * g_date_time_new_from_timeval_local (const GTimeVal *tv);
118 GLIB_AVAILABLE_IN_ALL
119 GDateTime * g_date_time_new_from_timeval_utc (const GTimeVal *tv);
121 GLIB_AVAILABLE_IN_ALL
122 GDateTime * g_date_time_new (GTimeZone *tz,
123 gint year,
124 gint month,
125 gint day,
126 gint hour,
127 gint minute,
128 gdouble seconds);
129 GLIB_AVAILABLE_IN_ALL
130 GDateTime * g_date_time_new_local (gint year,
131 gint month,
132 gint day,
133 gint hour,
134 gint minute,
135 gdouble seconds);
136 GLIB_AVAILABLE_IN_ALL
137 GDateTime * g_date_time_new_utc (gint year,
138 gint month,
139 gint day,
140 gint hour,
141 gint minute,
142 gdouble seconds);
144 GLIB_AVAILABLE_IN_ALL
145 G_GNUC_WARN_UNUSED_RESULT
146 GDateTime * g_date_time_add (GDateTime *datetime,
147 GTimeSpan timespan);
149 GLIB_AVAILABLE_IN_ALL
150 G_GNUC_WARN_UNUSED_RESULT
151 GDateTime * g_date_time_add_years (GDateTime *datetime,
152 gint years);
153 GLIB_AVAILABLE_IN_ALL
154 G_GNUC_WARN_UNUSED_RESULT
155 GDateTime * g_date_time_add_months (GDateTime *datetime,
156 gint months);
157 GLIB_AVAILABLE_IN_ALL
158 G_GNUC_WARN_UNUSED_RESULT
159 GDateTime * g_date_time_add_weeks (GDateTime *datetime,
160 gint weeks);
161 GLIB_AVAILABLE_IN_ALL
162 G_GNUC_WARN_UNUSED_RESULT
163 GDateTime * g_date_time_add_days (GDateTime *datetime,
164 gint days);
166 GLIB_AVAILABLE_IN_ALL
167 G_GNUC_WARN_UNUSED_RESULT
168 GDateTime * g_date_time_add_hours (GDateTime *datetime,
169 gint hours);
170 GLIB_AVAILABLE_IN_ALL
171 G_GNUC_WARN_UNUSED_RESULT
172 GDateTime * g_date_time_add_minutes (GDateTime *datetime,
173 gint minutes);
174 GLIB_AVAILABLE_IN_ALL
175 G_GNUC_WARN_UNUSED_RESULT
176 GDateTime * g_date_time_add_seconds (GDateTime *datetime,
177 gdouble seconds);
179 GLIB_AVAILABLE_IN_ALL
180 G_GNUC_WARN_UNUSED_RESULT
181 GDateTime * g_date_time_add_full (GDateTime *datetime,
182 gint years,
183 gint months,
184 gint days,
185 gint hours,
186 gint minutes,
187 gdouble seconds);
189 GLIB_AVAILABLE_IN_ALL
190 gint g_date_time_compare (gconstpointer dt1,
191 gconstpointer dt2);
192 GLIB_AVAILABLE_IN_ALL
193 GTimeSpan g_date_time_difference (GDateTime *end,
194 GDateTime *begin);
195 GLIB_AVAILABLE_IN_ALL
196 guint g_date_time_hash (gconstpointer datetime);
197 GLIB_AVAILABLE_IN_ALL
198 gboolean g_date_time_equal (gconstpointer dt1,
199 gconstpointer dt2);
201 GLIB_AVAILABLE_IN_ALL
202 void g_date_time_get_ymd (GDateTime *datetime,
203 gint *year,
204 gint *month,
205 gint *day);
207 GLIB_AVAILABLE_IN_ALL
208 gint g_date_time_get_year (GDateTime *datetime);
209 GLIB_AVAILABLE_IN_ALL
210 gint g_date_time_get_month (GDateTime *datetime);
211 GLIB_AVAILABLE_IN_ALL
212 gint g_date_time_get_day_of_month (GDateTime *datetime);
214 GLIB_AVAILABLE_IN_ALL
215 gint g_date_time_get_week_numbering_year (GDateTime *datetime);
216 GLIB_AVAILABLE_IN_ALL
217 gint g_date_time_get_week_of_year (GDateTime *datetime);
218 GLIB_AVAILABLE_IN_ALL
219 gint g_date_time_get_day_of_week (GDateTime *datetime);
221 GLIB_AVAILABLE_IN_ALL
222 gint g_date_time_get_day_of_year (GDateTime *datetime);
224 GLIB_AVAILABLE_IN_ALL
225 gint g_date_time_get_hour (GDateTime *datetime);
226 GLIB_AVAILABLE_IN_ALL
227 gint g_date_time_get_minute (GDateTime *datetime);
228 GLIB_AVAILABLE_IN_ALL
229 gint g_date_time_get_second (GDateTime *datetime);
230 GLIB_AVAILABLE_IN_ALL
231 gint g_date_time_get_microsecond (GDateTime *datetime);
232 GLIB_AVAILABLE_IN_ALL
233 gdouble g_date_time_get_seconds (GDateTime *datetime);
235 GLIB_AVAILABLE_IN_ALL
236 gint64 g_date_time_to_unix (GDateTime *datetime);
237 GLIB_AVAILABLE_IN_ALL
238 gboolean g_date_time_to_timeval (GDateTime *datetime,
239 GTimeVal *tv);
241 GLIB_AVAILABLE_IN_ALL
242 GTimeSpan g_date_time_get_utc_offset (GDateTime *datetime);
243 GLIB_AVAILABLE_IN_ALL
244 const gchar * g_date_time_get_timezone_abbreviation (GDateTime *datetime);
245 GLIB_AVAILABLE_IN_ALL
246 gboolean g_date_time_is_daylight_savings (GDateTime *datetime);
248 GLIB_AVAILABLE_IN_ALL
249 GDateTime * g_date_time_to_timezone (GDateTime *datetime,
250 GTimeZone *tz);
251 GLIB_AVAILABLE_IN_ALL
252 GDateTime * g_date_time_to_local (GDateTime *datetime);
253 GLIB_AVAILABLE_IN_ALL
254 GDateTime * g_date_time_to_utc (GDateTime *datetime);
256 GLIB_AVAILABLE_IN_ALL
257 gchar * g_date_time_format (GDateTime *datetime,
258 const gchar *format) G_GNUC_MALLOC;
260 G_END_DECLS
262 #endif /* __G_DATE_TIME_H__ */