/* datetime.vapi
 *
 * Copyright (C) 2009-2010 Christian Hergert <chris@dronelabs.com>
 *
 * This is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */


namespace GLib {
	[SimpleType]
	[CCode (cname = "gint64", cheader_filename = "glib.h", type_id = "G_TYPE_INT64", marshaller_type_name = "INT64", get_value_function = "g_value_get_int64",
	 set_value_function = "g_value_set_int64", default_value = "0LL", type_signature = "x")]
	[IntegerType (rank = 10)]
	public struct TimeSpan {
		[CCode (cname="(G_TIME_SPAN_DAY*7)")]
		public const TimeSpan WEEK;
		[CCode (cname="G_TIME_SPAN_DAY")]
		public const TimeSpan DAY;
		[CCode (cname="G_TIME_SPAN_HOUR")]
		public const TimeSpan HOUR;
		[CCode (cname="G_TIME_SPAN_MINUTE")]
		public const TimeSpan MINUTE;
		[CCode (cname="G_TIME_SPAN_SECOND")]
		public const TimeSpan SECOND;
		[CCode (cname="G_TIME_SPAN_MILLISECOND")]
		public const TimeSpan MILLISECOND;
	}


        [Compact]
        [CCode (cprefix="g_date_time_", ref_function = "g_date_time_ref", unref_function = "g_date_time_unref", type_id = "G_TYPE_DATE_TIME")]
        public class DateTime {
		[CCode (cname="g_date_time_now")]
		public DateTime.now ();
		public DateTime.from_date (int year, int month, int day);
		public DateTime.from_epoch (time_t sec);
		public DateTime.from_timeval (TimeVal tv);
		public DateTime.full (int year, int month, int day, int hour, int minute, int second, string? timezone=null);
		public DateTime.parse_with_format (string format, string input);
		[CCode (cname="g_date_time_today")]
		public DateTime.today ();
		[CCode (cname="g_date_time_utc_now")]
		public DateTime.utc_now ();
		public DateTime add (ref TimeSpan timespan);
		public DateTime add_days (int days);
		public DateTime add_full (int years, int months, int days, int hours=0, int minutes=0, int seconds=0);
		public DateTime add_hours (int hours);
		public DateTime add_milliseconds (int milliseconds);
		public DateTime add_minutes (int minutes);
		public DateTime add_months (int months);
		public DateTime add_seconds (int seconds);
		public DateTime add_weeks (int weeks);
		public DateTime add_years (int years);
		public int compare (DateTime dt);
		public DateTime copy ();
		public DateTime day ();
		public void difference (DateTime dt, out TimeSpan ts);
		public bool equal (DateTime dt);
		public int get_day_of_week ();
		public int get_day_of_month ();
		public int get_day_of_year ();
		public void get_dmy (out int day, out int month, out int year);
		public int get_hour ();
		public void get_julian (out int period, out int julian, out int hour, out int minute, out int second);
		public int get_microsecond ();
		public int get_millisecond ();
		public int get_minute ();
		public int get_month ();
		public int get_second ();
		public void get_utc_offset (out TimeSpan timespan);
		public int get_year ();
		public uint hash ();
		public bool is_leap_year ();
		public bool is_daylight_savings ();
		public string printf (string format="%a %b %d %X %z %Y");
		public DateTime to_local ();
		public time_t to_epoch ();
		public void to_timeval (out TimeVal tv);
		public DateTime to_utc ();
	}
}
