1 /* 2 * Distributed under the Boost Software License, Version 1.0. 3 * (See accompanying file LICENSE_1_0.txt or copy at 4 * http://www.boost.org/LICENSE_1_0.txt) 5 */ 6 module glib.gdatetime; 7 8 import glib.gtypes; 9 import glib.gtimezone; 10 11 12 13 enum gint64 G_TIME_SPAN_DAY = 86400000000; 14 enum gint64 G_TIME_SPAN_HOUR = 3600000000; 15 enum gint64 G_TIME_SPAN_MINUTE = 60000000; 16 enum gint64 G_TIME_SPAN_SECOND = 1000000; 17 enum gint64 G_TIME_SPAN_MILLISECOND = 1000; 18 19 alias GTimeSpan = gint64; 20 21 struct GDateTime; 22 23 24 extern (C) { 25 26 void g_date_time_unref (GDateTime *datetime); 27 28 GDateTime * g_date_time_ref (GDateTime *datetime); 29 30 31 GDateTime * g_date_time_new_now (GTimeZone *tz); 32 33 GDateTime * g_date_time_new_now_local (); 34 35 GDateTime * g_date_time_new_now_utc (); 36 37 38 GDateTime * g_date_time_new_from_unix_local (gint64 t); 39 40 GDateTime * g_date_time_new_from_unix_utc (gint64 t); 41 42 43 GDateTime * g_date_time_new_from_timeval_local (const(GTimeVal)*tv); 44 45 GDateTime * g_date_time_new_from_timeval_utc (const(GTimeVal)*tv); 46 47 48 GDateTime * g_date_time_new (GTimeZone *tz, 49 gint year, 50 gint month, 51 gint day, 52 gint hour, 53 gint minute, 54 gdouble seconds); 55 56 GDateTime * g_date_time_new_local (gint year, 57 gint month, 58 gint day, 59 gint hour, 60 gint minute, 61 gdouble seconds); 62 63 GDateTime * g_date_time_new_utc (gint year, 64 gint month, 65 gint day, 66 gint hour, 67 gint minute, 68 gdouble seconds); 69 70 71 GDateTime * g_date_time_add (GDateTime *datetime, 72 GTimeSpan timespan); 73 74 75 GDateTime * g_date_time_add_years (GDateTime *datetime, 76 gint years); 77 78 GDateTime * g_date_time_add_months (GDateTime *datetime, 79 gint months); 80 81 GDateTime * g_date_time_add_weeks (GDateTime *datetime, 82 gint weeks); 83 84 GDateTime * g_date_time_add_days (GDateTime *datetime, 85 gint days); 86 87 88 GDateTime * g_date_time_add_hours (GDateTime *datetime, 89 gint hours); 90 91 GDateTime * g_date_time_add_minutes (GDateTime *datetime, 92 gint minutes); 93 94 GDateTime * g_date_time_add_seconds (GDateTime *datetime, 95 gdouble seconds); 96 97 98 GDateTime * g_date_time_add_full (GDateTime *datetime, 99 gint years, 100 gint months, 101 gint days, 102 gint hours, 103 gint minutes, 104 gdouble seconds); 105 106 107 gint g_date_time_compare (gconstpointer dt1, 108 gconstpointer dt2); 109 110 GTimeSpan g_date_time_difference (GDateTime *end, 111 GDateTime *begin); 112 113 guint g_date_time_hash (gconstpointer datetime); 114 115 gboolean g_date_time_equal (gconstpointer dt1, 116 gconstpointer dt2); 117 118 119 void g_date_time_get_ymd (GDateTime *datetime, 120 gint *year, 121 gint *month, 122 gint *day); 123 124 125 gint g_date_time_get_year (GDateTime *datetime); 126 127 gint g_date_time_get_month (GDateTime *datetime); 128 129 gint g_date_time_get_day_of_month (GDateTime *datetime); 130 131 132 gint g_date_time_get_week_numbering_year (GDateTime *datetime); 133 134 gint g_date_time_get_week_of_year (GDateTime *datetime); 135 136 gint g_date_time_get_day_of_week (GDateTime *datetime); 137 138 139 gint g_date_time_get_day_of_year (GDateTime *datetime); 140 141 142 gint g_date_time_get_hour (GDateTime *datetime); 143 144 gint g_date_time_get_minute (GDateTime *datetime); 145 146 gint g_date_time_get_second (GDateTime *datetime); 147 148 gint g_date_time_get_microsecond (GDateTime *datetime); 149 150 gdouble g_date_time_get_seconds (GDateTime *datetime); 151 152 153 gint64 g_date_time_to_unix (GDateTime *datetime); 154 155 gboolean g_date_time_to_timeval (GDateTime *datetime, 156 GTimeVal *tv); 157 158 159 GTimeSpan g_date_time_get_utc_offset (GDateTime *datetime); 160 161 const(gchar) * g_date_time_get_timezone_abbreviation (GDateTime *datetime); 162 163 gboolean g_date_time_is_daylight_savings (GDateTime *datetime); 164 165 166 GDateTime * g_date_time_to_timezone (GDateTime *datetime, 167 GTimeZone *tz); 168 169 GDateTime * g_date_time_to_local (GDateTime *datetime); 170 171 GDateTime * g_date_time_to_utc (GDateTime *datetime); 172 173 174 gchar * g_date_time_format (GDateTime *datetime, 175 const(gchar) *format); 176 177 } 178