2 * Copyright (C) 2010 Thiago Santos <thiago.sousa.santos@collabora.co.uk>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
20 #ifndef __GST_DATE_TIME_H__
21 #define __GST_DATE_TIME_H__
31 * Opaque, immutable, refcounted struct that stores date, time and timezone
32 * information. It currently supports ranges from 0001-01-01 to
33 * 9999-12-31 in the Gregorian proleptic calendar.
35 * Use the accessor functions to get the stored values.
37 typedef struct _GstDateTime GstDateTime;
42 * a boxed #GValue type for #GstDateTime that represents a date and time.
44 * Returns: the #GType of GstDateTime
47 #define GST_TYPE_DATE_TIME gst_date_time_get_type()
49 GType gst_date_time_get_type (void);
51 /* query which fields are set */
53 gboolean gst_date_time_has_year (const GstDateTime * datetime);
54 gboolean gst_date_time_has_month (const GstDateTime * datetime);
55 gboolean gst_date_time_has_day (const GstDateTime * datetime);
56 gboolean gst_date_time_has_time (const GstDateTime * datetime);
57 gboolean gst_date_time_has_second (const GstDateTime * datetime);
61 gint gst_date_time_get_year (const GstDateTime * datetime);
62 gint gst_date_time_get_month (const GstDateTime * datetime);
63 gint gst_date_time_get_day (const GstDateTime * datetime);
64 gint gst_date_time_get_hour (const GstDateTime * datetime);
65 gint gst_date_time_get_minute (const GstDateTime * datetime);
66 gint gst_date_time_get_second (const GstDateTime * datetime);
67 gint gst_date_time_get_microsecond (const GstDateTime * datetime);
68 gfloat gst_date_time_get_time_zone_offset (const GstDateTime * datetime);
72 GstDateTime * gst_date_time_new_from_unix_epoch_local_time (gint64 secs) G_GNUC_MALLOC;
74 GstDateTime * gst_date_time_new_from_unix_epoch_utc (gint64 secs) G_GNUC_MALLOC;
76 GstDateTime * gst_date_time_new_local_time (gint year,
81 gdouble seconds) G_GNUC_MALLOC;
83 GstDateTime * gst_date_time_new_y (gint year) G_GNUC_MALLOC;
85 GstDateTime * gst_date_time_new_ym (gint year,
86 gint month) G_GNUC_MALLOC;
88 GstDateTime * gst_date_time_new_ymd (gint year,
90 gint day) G_GNUC_MALLOC;
92 GstDateTime * gst_date_time_new (gfloat tzoffset,
93 gint year, gint month,
96 gdouble seconds) G_GNUC_MALLOC;
98 GstDateTime * gst_date_time_new_now_local_time (void) G_GNUC_MALLOC;
100 GstDateTime * gst_date_time_new_now_utc (void) G_GNUC_MALLOC;
103 gchar * gst_date_time_to_iso8601_string (GstDateTime * datetime) G_GNUC_MALLOC;
104 GstDateTime * gst_date_time_new_from_iso8601_string (const gchar * string) G_GNUC_MALLOC;
106 GDateTime * gst_date_time_to_g_date_time (GstDateTime * datetime);
108 GstDateTime * gst_date_time_new_from_g_date_time (GDateTime * dt);
112 GstDateTime * gst_date_time_ref (GstDateTime * datetime);
114 void gst_date_time_unref (GstDateTime * datetime);
118 #endif /* __GST_DATE_TIME_H__ */