Github User Fetcher 1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
gdatetime.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2009-2010 Christian Hergert <chris@dronelabs.com>
3 * Copyright © 2010 Codethink Limited
4 *
5 * SPDX-License-Identifier: LGPL-2.1-or-later
6 *
7 * This library is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of the
10 * licence, or (at your option) any later version.
11 *
12 * This is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 * License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this library; if not, see <http://www.gnu.org/licenses/>.
19 *
20 * Authors: Christian Hergert <chris@dronelabs.com>
21 * Thiago Santos <thiago.sousa.santos@collabora.co.uk>
22 * Emmanuele Bassi <ebassi@linux.intel.com>
23 * Ryan Lortie <desrt@desrt.ca>
24 */
25
26#ifndef __G_DATE_TIME_H__
27#define __G_DATE_TIME_H__
28
29#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
30#error "Only <glib.h> can be included directly."
31#endif
32
33#include <glib/gtimezone.h>
34
36
37/**
38 * G_TIME_SPAN_DAY:
39 *
40 * Evaluates to a time span of one day.
41 *
42 * Since: 2.26
43 */
44#define G_TIME_SPAN_DAY (G_GINT64_CONSTANT (86400000000))
45
46/**
47 * G_TIME_SPAN_HOUR:
48 *
49 * Evaluates to a time span of one hour.
50 *
51 * Since: 2.26
52 */
53#define G_TIME_SPAN_HOUR (G_GINT64_CONSTANT (3600000000))
54
55/**
56 * G_TIME_SPAN_MINUTE:
57 *
58 * Evaluates to a time span of one minute.
59 *
60 * Since: 2.26
61 */
62#define G_TIME_SPAN_MINUTE (G_GINT64_CONSTANT (60000000))
63
64/**
65 * G_TIME_SPAN_SECOND:
66 *
67 * Evaluates to a time span of one second.
68 *
69 * Since: 2.26
70 */
71#define G_TIME_SPAN_SECOND (G_GINT64_CONSTANT (1000000))
72
73/**
74 * G_TIME_SPAN_MILLISECOND:
75 *
76 * Evaluates to a time span of one millisecond.
77 *
78 * Since: 2.26
79 */
80#define G_TIME_SPAN_MILLISECOND (G_GINT64_CONSTANT (1000))
81
82/**
83 * GTimeSpan:
84 *
85 * A value representing an interval of time, in microseconds.
86 *
87 * Since: 2.26
88 */
90
91/**
92 * GDateTime:
93 *
94 * `GDateTime` is a structure that combines a Gregorian date and time
95 * into a single structure.
96 *
97 * `GDateTime` provides many conversion and methods to manipulate dates and times.
98 * Time precision is provided down to microseconds and the time can range
99 * (proleptically) from 0001-01-01 00:00:00 to 9999-12-31 23:59:59.999999.
100 * `GDateTime` follows POSIX time in the sense that it is oblivious to leap
101 * seconds.
102 *
103 * `GDateTime` is an immutable object; once it has been created it cannot
104 * be modified further. All modifiers will create a new `GDateTime`.
105 * Nearly all such functions can fail due to the date or time going out
106 * of range, in which case %NULL will be returned.
107 *
108 * `GDateTime` is reference counted: the reference count is increased by calling
109 * [method@GLib.DateTime.ref] and decreased by calling [method@GLib.DateTime.unref].
110 * When the reference count drops to 0, the resources allocated by the `GDateTime`
111 * structure are released.
112 *
113 * Many parts of the API may produce non-obvious results. As an
114 * example, adding two months to January 31st will yield March 31st
115 * whereas adding one month and then one month again will yield either
116 * March 28th or March 29th. Also note that adding 24 hours is not
117 * always the same as adding one day (since days containing daylight
118 * savings time transitions are either 23 or 25 hours in length).
119 *
120 * Since: 2.26
121 */
122typedef struct _GDateTime GDateTime;
123
128
135
140
145
152
155 GTimeZone *default_tz);
156
159 gint year,
160 gint month,
161 gint day,
162 gint hour,
163 gint minute,
164 gdouble seconds);
167 gint month,
168 gint day,
169 gint hour,
170 gint minute,
171 gdouble seconds);
174 gint month,
175 gint day,
176 gint hour,
177 gint minute,
178 gdouble seconds);
179
183 GTimeSpan timespan);
184
188 gint years);
192 gint months);
196 gint weeks);
200 gint days);
201
205 gint hours);
209 gint minutes);
213 gdouble seconds);
214
218 gint years,
219 gint months,
220 gint days,
221 gint hours,
222 gint minutes,
223 gdouble seconds);
224
227 gconstpointer dt2);
230 GDateTime *begin);
235 gconstpointer dt2);
236
239 gint *year,
240 gint *month,
241 gint *day);
242
249
256
259
270
275
279 GTimeVal *tv);
281
290
293 GTimeZone *tz);
298
301 const gchar *format) G_GNUC_MALLOC;
304
306
307#endif /* __G_DATE_TIME_H__ */
GLIB_AVAILABLE_IN_ALL gboolean g_date_time_equal(gconstpointer dt1, gconstpointer dt2)
GLIB_AVAILABLE_IN_ALL G_GNUC_WARN_UNUSED_RESULT GDateTime * g_date_time_add_minutes(GDateTime *datetime, gint minutes)
GLIB_AVAILABLE_IN_ALL gint g_date_time_get_second(GDateTime *datetime)
GLIB_AVAILABLE_IN_ALL GDateTime * g_date_time_new_from_unix_utc(gint64 t)
GLIB_AVAILABLE_IN_ALL GDateTime * g_date_time_to_utc(GDateTime *datetime)
struct _GDateTime GDateTime
Definition gdatetime.h:122
G_GNUC_END_IGNORE_DEPRECATIONS GLIB_AVAILABLE_IN_2_56 GDateTime * g_date_time_new_from_iso8601(const gchar *text, GTimeZone *default_tz)
GDateTime * g_date_time_new_from_timeval_utc(const GTimeVal *tv)
GLIB_AVAILABLE_IN_ALL gchar * g_date_time_format(GDateTime *datetime, const gchar *format) G_GNUC_MALLOC
G_GNUC_END_IGNORE_DEPRECATIONS GLIB_AVAILABLE_IN_ALL GTimeSpan g_date_time_get_utc_offset(GDateTime *datetime)
G_GNUC_BEGIN_IGNORE_DEPRECATIONS GDateTime * g_date_time_new_from_timeval_local(const GTimeVal *tv)
GLIB_AVAILABLE_IN_ALL gint g_date_time_get_day_of_year(GDateTime *datetime)
GLIB_AVAILABLE_IN_ALL GTimeSpan g_date_time_difference(GDateTime *end, GDateTime *begin)
GLIB_AVAILABLE_IN_ALL gint64 g_date_time_to_unix(GDateTime *datetime)
GLIB_AVAILABLE_IN_2_80 gint64 g_date_time_to_unix_usec(GDateTime *datetime)
GLIB_AVAILABLE_IN_ALL const gchar * g_date_time_get_timezone_abbreviation(GDateTime *datetime)
gint64 GTimeSpan
Definition gdatetime.h:89
GLIB_AVAILABLE_IN_ALL gint g_date_time_get_month(GDateTime *datetime)
GLIB_AVAILABLE_IN_ALL gint g_date_time_get_day_of_week(GDateTime *datetime)
GLIB_AVAILABLE_IN_ALL GDateTime * g_date_time_new_utc(gint year, gint month, gint day, gint hour, gint minute, gdouble seconds)
G_GNUC_BEGIN_IGNORE_DEPRECATIONS gboolean g_date_time_to_timeval(GDateTime *datetime, GTimeVal *tv)
GLIB_AVAILABLE_IN_ALL GDateTime * g_date_time_new_now_local(void)
GLIB_AVAILABLE_IN_2_58 GTimeZone * g_date_time_get_timezone(GDateTime *datetime)
GLIB_AVAILABLE_IN_ALL gint g_date_time_get_minute(GDateTime *datetime)
GLIB_AVAILABLE_IN_ALL void g_date_time_unref(GDateTime *datetime)
GLIB_AVAILABLE_IN_ALL gdouble g_date_time_get_seconds(GDateTime *datetime)
GLIB_AVAILABLE_IN_ALL gint g_date_time_get_week_numbering_year(GDateTime *datetime)
GLIB_AVAILABLE_IN_ALL G_GNUC_WARN_UNUSED_RESULT GDateTime * g_date_time_add_weeks(GDateTime *datetime, gint weeks)
GLIB_AVAILABLE_IN_ALL gint g_date_time_get_week_of_year(GDateTime *datetime)
GLIB_AVAILABLE_IN_ALL void g_date_time_get_ymd(GDateTime *datetime, gint *year, gint *month, gint *day)
GLIB_AVAILABLE_IN_ALL gint g_date_time_get_day_of_month(GDateTime *datetime)
GLIB_AVAILABLE_IN_ALL gint g_date_time_get_year(GDateTime *datetime)
GLIB_AVAILABLE_IN_ALL G_GNUC_WARN_UNUSED_RESULT GDateTime * g_date_time_add_full(GDateTime *datetime, gint years, gint months, gint days, gint hours, gint minutes, gdouble seconds)
GLIB_AVAILABLE_IN_ALL G_GNUC_WARN_UNUSED_RESULT GDateTime * g_date_time_add_hours(GDateTime *datetime, gint hours)
GLIB_AVAILABLE_IN_ALL gint g_date_time_get_microsecond(GDateTime *datetime)
GLIB_AVAILABLE_IN_ALL gboolean g_date_time_is_daylight_savings(GDateTime *datetime)
GLIB_AVAILABLE_IN_ALL guint g_date_time_hash(gconstpointer datetime)
GLIB_AVAILABLE_IN_ALL GDateTime * g_date_time_new_local(gint year, gint month, gint day, gint hour, gint minute, gdouble seconds)
GLIB_AVAILABLE_IN_ALL GDateTime * g_date_time_new_now(GTimeZone *tz)
GLIB_AVAILABLE_IN_ALL G_GNUC_WARN_UNUSED_RESULT GDateTime * g_date_time_add_months(GDateTime *datetime, gint months)
GLIB_AVAILABLE_IN_ALL GDateTime * g_date_time_new(GTimeZone *tz, gint year, gint month, gint day, gint hour, gint minute, gdouble seconds)
GLIB_AVAILABLE_IN_ALL GDateTime * g_date_time_new_now_utc(void)
GLIB_AVAILABLE_IN_ALL G_GNUC_WARN_UNUSED_RESULT GDateTime * g_date_time_add_days(GDateTime *datetime, gint days)
GLIB_AVAILABLE_IN_ALL GDateTime * g_date_time_new_from_unix_local(gint64 t)
GLIB_AVAILABLE_IN_2_62 gchar * g_date_time_format_iso8601(GDateTime *datetime) G_GNUC_MALLOC
GLIB_AVAILABLE_IN_2_80 GDateTime * g_date_time_new_from_unix_local_usec(gint64 usecs)
GLIB_AVAILABLE_IN_ALL GDateTime * g_date_time_to_local(GDateTime *datetime)
GLIB_AVAILABLE_IN_ALL gint g_date_time_compare(gconstpointer dt1, gconstpointer dt2)
GLIB_AVAILABLE_IN_ALL G_GNUC_WARN_UNUSED_RESULT GDateTime * g_date_time_add(GDateTime *datetime, GTimeSpan timespan)
GLIB_AVAILABLE_IN_ALL GDateTime * g_date_time_to_timezone(GDateTime *datetime, GTimeZone *tz)
GLIB_AVAILABLE_IN_ALL G_GNUC_WARN_UNUSED_RESULT GDateTime * g_date_time_add_seconds(GDateTime *datetime, gdouble seconds)
GLIB_AVAILABLE_IN_ALL G_GNUC_WARN_UNUSED_RESULT GDateTime * g_date_time_add_years(GDateTime *datetime, gint years)
GLIB_AVAILABLE_IN_ALL GDateTime * g_date_time_ref(GDateTime *datetime)
GLIB_AVAILABLE_IN_2_80 GDateTime * g_date_time_new_from_unix_utc_usec(gint64 usecs)
GLIB_AVAILABLE_IN_ALL gint g_date_time_get_hour(GDateTime *datetime)
#define GLIB_DEPRECATED_IN_2_62_FOR(f)
#define GLIB_AVAILABLE_IN_ALL
#define GLIB_AVAILABLE_IN_2_58
#define GLIB_AVAILABLE_IN_2_62
#define GLIB_AVAILABLE_IN_2_56
#define GLIB_AVAILABLE_IN_2_80
signed long gint64
Definition glibconfig.h:66
#define G_GNUC_WARN_UNUSED_RESULT
Definition gmacros.h:814
#define G_GNUC_MALLOC
Definition gmacros.h:293
#define G_END_DECLS
Definition gmacros.h:910
#define G_BEGIN_DECLS
Definition gmacros.h:909
#define G_GNUC_BEGIN_IGNORE_DEPRECATIONS
Definition gmacros.h:771
#define G_GNUC_END_IGNORE_DEPRECATIONS
Definition gmacros.h:772
typedefG_BEGIN_DECLS struct _GTimeZone GTimeZone
Definition gtimezone.h:34
gint gboolean
Definition gtypes.h:56
G_BEGIN_DECLS typedef char gchar
Definition gtypes.h:52
int gint
Definition gtypes.h:55
const void * gconstpointer
Definition gtypes.h:110
double gdouble
Definition gtypes.h:64
unsigned int guint
Definition gtypes.h:61
json_t format(printf, 1, 2)))