512 lines
22 KiB
C#
Executable file
512 lines
22 KiB
C#
Executable file
// This file was generated by the Gtk# code generator.
|
|
// Any changes made will be lost if regenerated.
|
|
|
|
namespace GLib {
|
|
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Runtime.InteropServices;
|
|
|
|
#region Autogenerated code
|
|
public partial class DateTime : GLib.Opaque {
|
|
|
|
delegate IntPtr d_g_date_time_get_type();
|
|
static d_g_date_time_get_type g_date_time_get_type = Marshal.GetDelegateForFunctionPointer<d_g_date_time_get_type>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_get_type"));
|
|
|
|
public static GLib.GType GType {
|
|
get {
|
|
IntPtr raw_ret = g_date_time_get_type();
|
|
GLib.GType ret = new GLib.GType(raw_ret);
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
delegate IntPtr d_g_date_time_add(IntPtr raw, long timespan);
|
|
static d_g_date_time_add g_date_time_add = Marshal.GetDelegateForFunctionPointer<d_g_date_time_add>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_add"));
|
|
|
|
public GLib.DateTime Add(long timespan) {
|
|
IntPtr raw_ret = g_date_time_add(Handle, timespan);
|
|
GLib.DateTime ret = raw_ret == IntPtr.Zero ? null : (GLib.DateTime) GLib.Opaque.GetOpaque (raw_ret, typeof (GLib.DateTime), true);
|
|
return ret;
|
|
}
|
|
|
|
delegate IntPtr d_g_date_time_add_days(IntPtr raw, int days);
|
|
static d_g_date_time_add_days g_date_time_add_days = Marshal.GetDelegateForFunctionPointer<d_g_date_time_add_days>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_add_days"));
|
|
|
|
public GLib.DateTime AddDays(int days) {
|
|
IntPtr raw_ret = g_date_time_add_days(Handle, days);
|
|
GLib.DateTime ret = raw_ret == IntPtr.Zero ? null : (GLib.DateTime) GLib.Opaque.GetOpaque (raw_ret, typeof (GLib.DateTime), true);
|
|
return ret;
|
|
}
|
|
|
|
delegate IntPtr d_g_date_time_add_full(IntPtr raw, int years, int months, int days, int hours, int minutes, double seconds);
|
|
static d_g_date_time_add_full g_date_time_add_full = Marshal.GetDelegateForFunctionPointer<d_g_date_time_add_full>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_add_full"));
|
|
|
|
public GLib.DateTime AddFull(int years, int months, int days, int hours, int minutes, double seconds) {
|
|
IntPtr raw_ret = g_date_time_add_full(Handle, years, months, days, hours, minutes, seconds);
|
|
GLib.DateTime ret = raw_ret == IntPtr.Zero ? null : (GLib.DateTime) GLib.Opaque.GetOpaque (raw_ret, typeof (GLib.DateTime), true);
|
|
return ret;
|
|
}
|
|
|
|
delegate IntPtr d_g_date_time_add_hours(IntPtr raw, int hours);
|
|
static d_g_date_time_add_hours g_date_time_add_hours = Marshal.GetDelegateForFunctionPointer<d_g_date_time_add_hours>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_add_hours"));
|
|
|
|
public GLib.DateTime AddHours(int hours) {
|
|
IntPtr raw_ret = g_date_time_add_hours(Handle, hours);
|
|
GLib.DateTime ret = raw_ret == IntPtr.Zero ? null : (GLib.DateTime) GLib.Opaque.GetOpaque (raw_ret, typeof (GLib.DateTime), true);
|
|
return ret;
|
|
}
|
|
|
|
delegate IntPtr d_g_date_time_add_minutes(IntPtr raw, int minutes);
|
|
static d_g_date_time_add_minutes g_date_time_add_minutes = Marshal.GetDelegateForFunctionPointer<d_g_date_time_add_minutes>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_add_minutes"));
|
|
|
|
public GLib.DateTime AddMinutes(int minutes) {
|
|
IntPtr raw_ret = g_date_time_add_minutes(Handle, minutes);
|
|
GLib.DateTime ret = raw_ret == IntPtr.Zero ? null : (GLib.DateTime) GLib.Opaque.GetOpaque (raw_ret, typeof (GLib.DateTime), true);
|
|
return ret;
|
|
}
|
|
|
|
delegate IntPtr d_g_date_time_add_months(IntPtr raw, int months);
|
|
static d_g_date_time_add_months g_date_time_add_months = Marshal.GetDelegateForFunctionPointer<d_g_date_time_add_months>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_add_months"));
|
|
|
|
public GLib.DateTime AddMonths(int months) {
|
|
IntPtr raw_ret = g_date_time_add_months(Handle, months);
|
|
GLib.DateTime ret = raw_ret == IntPtr.Zero ? null : (GLib.DateTime) GLib.Opaque.GetOpaque (raw_ret, typeof (GLib.DateTime), true);
|
|
return ret;
|
|
}
|
|
|
|
delegate IntPtr d_g_date_time_add_seconds(IntPtr raw, double seconds);
|
|
static d_g_date_time_add_seconds g_date_time_add_seconds = Marshal.GetDelegateForFunctionPointer<d_g_date_time_add_seconds>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_add_seconds"));
|
|
|
|
public GLib.DateTime AddSeconds(double seconds) {
|
|
IntPtr raw_ret = g_date_time_add_seconds(Handle, seconds);
|
|
GLib.DateTime ret = raw_ret == IntPtr.Zero ? null : (GLib.DateTime) GLib.Opaque.GetOpaque (raw_ret, typeof (GLib.DateTime), true);
|
|
return ret;
|
|
}
|
|
|
|
delegate IntPtr d_g_date_time_add_weeks(IntPtr raw, int weeks);
|
|
static d_g_date_time_add_weeks g_date_time_add_weeks = Marshal.GetDelegateForFunctionPointer<d_g_date_time_add_weeks>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_add_weeks"));
|
|
|
|
public GLib.DateTime AddWeeks(int weeks) {
|
|
IntPtr raw_ret = g_date_time_add_weeks(Handle, weeks);
|
|
GLib.DateTime ret = raw_ret == IntPtr.Zero ? null : (GLib.DateTime) GLib.Opaque.GetOpaque (raw_ret, typeof (GLib.DateTime), true);
|
|
return ret;
|
|
}
|
|
|
|
delegate IntPtr d_g_date_time_add_years(IntPtr raw, int years);
|
|
static d_g_date_time_add_years g_date_time_add_years = Marshal.GetDelegateForFunctionPointer<d_g_date_time_add_years>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_add_years"));
|
|
|
|
public GLib.DateTime AddYears(int years) {
|
|
IntPtr raw_ret = g_date_time_add_years(Handle, years);
|
|
GLib.DateTime ret = raw_ret == IntPtr.Zero ? null : (GLib.DateTime) GLib.Opaque.GetOpaque (raw_ret, typeof (GLib.DateTime), true);
|
|
return ret;
|
|
}
|
|
|
|
delegate long d_g_date_time_difference(IntPtr raw, IntPtr begin);
|
|
static d_g_date_time_difference g_date_time_difference = Marshal.GetDelegateForFunctionPointer<d_g_date_time_difference>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_difference"));
|
|
|
|
public long Difference(GLib.DateTime begin) {
|
|
long raw_ret = g_date_time_difference(Handle, begin == null ? IntPtr.Zero : begin.Handle);
|
|
long ret = raw_ret;
|
|
return ret;
|
|
}
|
|
|
|
delegate IntPtr d_g_date_time_format(IntPtr raw, IntPtr format);
|
|
static d_g_date_time_format g_date_time_format = Marshal.GetDelegateForFunctionPointer<d_g_date_time_format>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_format"));
|
|
|
|
public string Format(string format) {
|
|
IntPtr native_format = GLib.Marshaller.StringToPtrGStrdup (format);
|
|
IntPtr raw_ret = g_date_time_format(Handle, native_format);
|
|
string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
|
|
GLib.Marshaller.Free (native_format);
|
|
return ret;
|
|
}
|
|
|
|
delegate int d_g_date_time_get_day_of_month(IntPtr raw);
|
|
static d_g_date_time_get_day_of_month g_date_time_get_day_of_month = Marshal.GetDelegateForFunctionPointer<d_g_date_time_get_day_of_month>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_get_day_of_month"));
|
|
|
|
public int DayOfMonth {
|
|
get {
|
|
int raw_ret = g_date_time_get_day_of_month(Handle);
|
|
int ret = raw_ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
delegate int d_g_date_time_get_day_of_week(IntPtr raw);
|
|
static d_g_date_time_get_day_of_week g_date_time_get_day_of_week = Marshal.GetDelegateForFunctionPointer<d_g_date_time_get_day_of_week>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_get_day_of_week"));
|
|
|
|
public int DayOfWeek {
|
|
get {
|
|
int raw_ret = g_date_time_get_day_of_week(Handle);
|
|
int ret = raw_ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
delegate int d_g_date_time_get_day_of_year(IntPtr raw);
|
|
static d_g_date_time_get_day_of_year g_date_time_get_day_of_year = Marshal.GetDelegateForFunctionPointer<d_g_date_time_get_day_of_year>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_get_day_of_year"));
|
|
|
|
public int DayOfYear {
|
|
get {
|
|
int raw_ret = g_date_time_get_day_of_year(Handle);
|
|
int ret = raw_ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
delegate int d_g_date_time_get_hour(IntPtr raw);
|
|
static d_g_date_time_get_hour g_date_time_get_hour = Marshal.GetDelegateForFunctionPointer<d_g_date_time_get_hour>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_get_hour"));
|
|
|
|
public int Hour {
|
|
get {
|
|
int raw_ret = g_date_time_get_hour(Handle);
|
|
int ret = raw_ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
delegate int d_g_date_time_get_microsecond(IntPtr raw);
|
|
static d_g_date_time_get_microsecond g_date_time_get_microsecond = Marshal.GetDelegateForFunctionPointer<d_g_date_time_get_microsecond>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_get_microsecond"));
|
|
|
|
public int Microsecond {
|
|
get {
|
|
int raw_ret = g_date_time_get_microsecond(Handle);
|
|
int ret = raw_ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
delegate int d_g_date_time_get_minute(IntPtr raw);
|
|
static d_g_date_time_get_minute g_date_time_get_minute = Marshal.GetDelegateForFunctionPointer<d_g_date_time_get_minute>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_get_minute"));
|
|
|
|
public int Minute {
|
|
get {
|
|
int raw_ret = g_date_time_get_minute(Handle);
|
|
int ret = raw_ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
delegate int d_g_date_time_get_month(IntPtr raw);
|
|
static d_g_date_time_get_month g_date_time_get_month = Marshal.GetDelegateForFunctionPointer<d_g_date_time_get_month>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_get_month"));
|
|
|
|
public int Month {
|
|
get {
|
|
int raw_ret = g_date_time_get_month(Handle);
|
|
int ret = raw_ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
delegate int d_g_date_time_get_second(IntPtr raw);
|
|
static d_g_date_time_get_second g_date_time_get_second = Marshal.GetDelegateForFunctionPointer<d_g_date_time_get_second>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_get_second"));
|
|
|
|
public int Second {
|
|
get {
|
|
int raw_ret = g_date_time_get_second(Handle);
|
|
int ret = raw_ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
delegate double d_g_date_time_get_seconds(IntPtr raw);
|
|
static d_g_date_time_get_seconds g_date_time_get_seconds = Marshal.GetDelegateForFunctionPointer<d_g_date_time_get_seconds>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_get_seconds"));
|
|
|
|
public double Seconds {
|
|
get {
|
|
double raw_ret = g_date_time_get_seconds(Handle);
|
|
double ret = raw_ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
delegate IntPtr d_g_date_time_get_timezone_abbreviation(IntPtr raw);
|
|
static d_g_date_time_get_timezone_abbreviation g_date_time_get_timezone_abbreviation = Marshal.GetDelegateForFunctionPointer<d_g_date_time_get_timezone_abbreviation>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_get_timezone_abbreviation"));
|
|
|
|
public string TimezoneAbbreviation {
|
|
get {
|
|
IntPtr raw_ret = g_date_time_get_timezone_abbreviation(Handle);
|
|
string ret = GLib.Marshaller.Utf8PtrToString (raw_ret);
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
delegate long d_g_date_time_get_utc_offset(IntPtr raw);
|
|
static d_g_date_time_get_utc_offset g_date_time_get_utc_offset = Marshal.GetDelegateForFunctionPointer<d_g_date_time_get_utc_offset>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_get_utc_offset"));
|
|
|
|
public long UtcOffset {
|
|
get {
|
|
long raw_ret = g_date_time_get_utc_offset(Handle);
|
|
long ret = raw_ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
delegate int d_g_date_time_get_week_numbering_year(IntPtr raw);
|
|
static d_g_date_time_get_week_numbering_year g_date_time_get_week_numbering_year = Marshal.GetDelegateForFunctionPointer<d_g_date_time_get_week_numbering_year>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_get_week_numbering_year"));
|
|
|
|
public int WeekNumberingYear {
|
|
get {
|
|
int raw_ret = g_date_time_get_week_numbering_year(Handle);
|
|
int ret = raw_ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
delegate int d_g_date_time_get_week_of_year(IntPtr raw);
|
|
static d_g_date_time_get_week_of_year g_date_time_get_week_of_year = Marshal.GetDelegateForFunctionPointer<d_g_date_time_get_week_of_year>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_get_week_of_year"));
|
|
|
|
public int WeekOfYear {
|
|
get {
|
|
int raw_ret = g_date_time_get_week_of_year(Handle);
|
|
int ret = raw_ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
delegate int d_g_date_time_get_year(IntPtr raw);
|
|
static d_g_date_time_get_year g_date_time_get_year = Marshal.GetDelegateForFunctionPointer<d_g_date_time_get_year>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_get_year"));
|
|
|
|
public int Year {
|
|
get {
|
|
int raw_ret = g_date_time_get_year(Handle);
|
|
int ret = raw_ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
delegate void d_g_date_time_get_ymd(IntPtr raw, out int year, out int month, out int day);
|
|
static d_g_date_time_get_ymd g_date_time_get_ymd = Marshal.GetDelegateForFunctionPointer<d_g_date_time_get_ymd>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_get_ymd"));
|
|
|
|
public void GetYmd(out int year, out int month, out int day) {
|
|
g_date_time_get_ymd(Handle, out year, out month, out day);
|
|
}
|
|
|
|
delegate bool d_g_date_time_is_daylight_savings(IntPtr raw);
|
|
static d_g_date_time_is_daylight_savings g_date_time_is_daylight_savings = Marshal.GetDelegateForFunctionPointer<d_g_date_time_is_daylight_savings>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_is_daylight_savings"));
|
|
|
|
public bool IsDaylightSavings {
|
|
get {
|
|
bool raw_ret = g_date_time_is_daylight_savings(Handle);
|
|
bool ret = raw_ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
delegate IntPtr d_g_date_time_to_local(IntPtr raw);
|
|
static d_g_date_time_to_local g_date_time_to_local = Marshal.GetDelegateForFunctionPointer<d_g_date_time_to_local>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_to_local"));
|
|
|
|
public GLib.DateTime ToLocal() {
|
|
IntPtr raw_ret = g_date_time_to_local(Handle);
|
|
GLib.DateTime ret = raw_ret == IntPtr.Zero ? null : (GLib.DateTime) GLib.Opaque.GetOpaque (raw_ret, typeof (GLib.DateTime), true);
|
|
return ret;
|
|
}
|
|
|
|
delegate bool d_g_date_time_to_timeval(IntPtr raw, IntPtr tv);
|
|
static d_g_date_time_to_timeval g_date_time_to_timeval = Marshal.GetDelegateForFunctionPointer<d_g_date_time_to_timeval>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_to_timeval"));
|
|
|
|
public bool ToTimeval(GLib.TimeVal tv) {
|
|
IntPtr native_tv = GLib.Marshaller.StructureToPtrAlloc (tv);
|
|
bool raw_ret = g_date_time_to_timeval(Handle, native_tv);
|
|
bool ret = raw_ret;
|
|
tv = GLib.TimeVal.New (native_tv);
|
|
Marshal.FreeHGlobal (native_tv);
|
|
return ret;
|
|
}
|
|
|
|
delegate IntPtr d_g_date_time_to_timezone(IntPtr raw, IntPtr tz);
|
|
static d_g_date_time_to_timezone g_date_time_to_timezone = Marshal.GetDelegateForFunctionPointer<d_g_date_time_to_timezone>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_to_timezone"));
|
|
|
|
public GLib.DateTime ToTimezone(GLib.TimeZone tz) {
|
|
IntPtr raw_ret = g_date_time_to_timezone(Handle, tz == null ? IntPtr.Zero : tz.Handle);
|
|
GLib.DateTime ret = raw_ret == IntPtr.Zero ? null : (GLib.DateTime) GLib.Opaque.GetOpaque (raw_ret, typeof (GLib.DateTime), true);
|
|
return ret;
|
|
}
|
|
|
|
delegate long d_g_date_time_to_unix(IntPtr raw);
|
|
static d_g_date_time_to_unix g_date_time_to_unix = Marshal.GetDelegateForFunctionPointer<d_g_date_time_to_unix>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_to_unix"));
|
|
|
|
public long ToUnix() {
|
|
long raw_ret = g_date_time_to_unix(Handle);
|
|
long ret = raw_ret;
|
|
return ret;
|
|
}
|
|
|
|
delegate IntPtr d_g_date_time_to_utc(IntPtr raw);
|
|
static d_g_date_time_to_utc g_date_time_to_utc = Marshal.GetDelegateForFunctionPointer<d_g_date_time_to_utc>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_to_utc"));
|
|
|
|
public GLib.DateTime ToUtc() {
|
|
IntPtr raw_ret = g_date_time_to_utc(Handle);
|
|
GLib.DateTime ret = raw_ret == IntPtr.Zero ? null : (GLib.DateTime) GLib.Opaque.GetOpaque (raw_ret, typeof (GLib.DateTime), true);
|
|
return ret;
|
|
}
|
|
|
|
delegate int d_g_date_time_compare(IntPtr dt1, IntPtr dt2);
|
|
static d_g_date_time_compare g_date_time_compare = Marshal.GetDelegateForFunctionPointer<d_g_date_time_compare>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_compare"));
|
|
|
|
public static int Compare(IntPtr dt1, IntPtr dt2) {
|
|
int raw_ret = g_date_time_compare(dt1, dt2);
|
|
int ret = raw_ret;
|
|
return ret;
|
|
}
|
|
|
|
delegate bool d_g_date_time_equal(IntPtr dt1, IntPtr dt2);
|
|
static d_g_date_time_equal g_date_time_equal = Marshal.GetDelegateForFunctionPointer<d_g_date_time_equal>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_equal"));
|
|
|
|
public static bool Equal(IntPtr dt1, IntPtr dt2) {
|
|
bool raw_ret = g_date_time_equal(dt1, dt2);
|
|
bool ret = raw_ret;
|
|
return ret;
|
|
}
|
|
|
|
delegate uint d_g_date_time_hash(IntPtr datetime);
|
|
static d_g_date_time_hash g_date_time_hash = Marshal.GetDelegateForFunctionPointer<d_g_date_time_hash>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_hash"));
|
|
|
|
public static uint Hash(IntPtr datetime) {
|
|
uint raw_ret = g_date_time_hash(datetime);
|
|
uint ret = raw_ret;
|
|
return ret;
|
|
}
|
|
|
|
public DateTime(IntPtr raw) : base(raw) {}
|
|
|
|
delegate IntPtr d_g_date_time_new(IntPtr tz, int year, int month, int day, int hour, int minute, double seconds);
|
|
static d_g_date_time_new g_date_time_new = Marshal.GetDelegateForFunctionPointer<d_g_date_time_new>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_new"));
|
|
|
|
public DateTime (GLib.TimeZone tz, int year, int month, int day, int hour, int minute, double seconds)
|
|
{
|
|
Raw = g_date_time_new(tz == null ? IntPtr.Zero : tz.Handle, year, month, day, hour, minute, seconds);
|
|
}
|
|
|
|
delegate IntPtr d_g_date_time_new_from_timeval_local(IntPtr tv);
|
|
static d_g_date_time_new_from_timeval_local g_date_time_new_from_timeval_local = Marshal.GetDelegateForFunctionPointer<d_g_date_time_new_from_timeval_local>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_new_from_timeval_local"));
|
|
|
|
public DateTime (GLib.TimeVal tv)
|
|
{
|
|
IntPtr native_tv = GLib.Marshaller.StructureToPtrAlloc (tv);
|
|
Raw = g_date_time_new_from_timeval_local(native_tv);
|
|
tv = GLib.TimeVal.New (native_tv);
|
|
Marshal.FreeHGlobal (native_tv);
|
|
}
|
|
|
|
delegate IntPtr d_g_date_time_new_from_timeval_utc(IntPtr tv);
|
|
static d_g_date_time_new_from_timeval_utc g_date_time_new_from_timeval_utc = Marshal.GetDelegateForFunctionPointer<d_g_date_time_new_from_timeval_utc>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_new_from_timeval_utc"));
|
|
|
|
public static DateTime NewFromTimevalUtc(GLib.TimeVal tv)
|
|
{
|
|
IntPtr native_tv = GLib.Marshaller.StructureToPtrAlloc (tv);
|
|
DateTime result = new DateTime (g_date_time_new_from_timeval_utc(native_tv));
|
|
tv = GLib.TimeVal.New (native_tv);
|
|
Marshal.FreeHGlobal (native_tv);
|
|
return result;
|
|
}
|
|
|
|
delegate IntPtr d_g_date_time_new_from_unix_local(long t);
|
|
static d_g_date_time_new_from_unix_local g_date_time_new_from_unix_local = Marshal.GetDelegateForFunctionPointer<d_g_date_time_new_from_unix_local>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_new_from_unix_local"));
|
|
|
|
public DateTime (long t)
|
|
{
|
|
Raw = g_date_time_new_from_unix_local(t);
|
|
}
|
|
|
|
delegate IntPtr d_g_date_time_new_from_unix_utc(long t);
|
|
static d_g_date_time_new_from_unix_utc g_date_time_new_from_unix_utc = Marshal.GetDelegateForFunctionPointer<d_g_date_time_new_from_unix_utc>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_new_from_unix_utc"));
|
|
|
|
public static DateTime NewFromUnixUtc(long t)
|
|
{
|
|
DateTime result = new DateTime (g_date_time_new_from_unix_utc(t));
|
|
return result;
|
|
}
|
|
|
|
delegate IntPtr d_g_date_time_new_local(int year, int month, int day, int hour, int minute, double seconds);
|
|
static d_g_date_time_new_local g_date_time_new_local = Marshal.GetDelegateForFunctionPointer<d_g_date_time_new_local>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_new_local"));
|
|
|
|
public DateTime (int year, int month, int day, int hour, int minute, double seconds)
|
|
{
|
|
Raw = g_date_time_new_local(year, month, day, hour, minute, seconds);
|
|
}
|
|
|
|
delegate IntPtr d_g_date_time_new_now(IntPtr tz);
|
|
static d_g_date_time_new_now g_date_time_new_now = Marshal.GetDelegateForFunctionPointer<d_g_date_time_new_now>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_new_now"));
|
|
|
|
public DateTime (GLib.TimeZone tz)
|
|
{
|
|
Raw = g_date_time_new_now(tz == null ? IntPtr.Zero : tz.Handle);
|
|
}
|
|
|
|
delegate IntPtr d_g_date_time_new_now_local();
|
|
static d_g_date_time_new_now_local g_date_time_new_now_local = Marshal.GetDelegateForFunctionPointer<d_g_date_time_new_now_local>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_new_now_local"));
|
|
|
|
public DateTime ()
|
|
{
|
|
Raw = g_date_time_new_now_local();
|
|
}
|
|
|
|
delegate IntPtr d_g_date_time_new_now_utc();
|
|
static d_g_date_time_new_now_utc g_date_time_new_now_utc = Marshal.GetDelegateForFunctionPointer<d_g_date_time_new_now_utc>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_new_now_utc"));
|
|
|
|
public static DateTime NewNowUtc()
|
|
{
|
|
DateTime result = new DateTime (g_date_time_new_now_utc());
|
|
return result;
|
|
}
|
|
|
|
delegate IntPtr d_g_date_time_new_utc(int year, int month, int day, int hour, int minute, double seconds);
|
|
static d_g_date_time_new_utc g_date_time_new_utc = Marshal.GetDelegateForFunctionPointer<d_g_date_time_new_utc>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_new_utc"));
|
|
|
|
public static DateTime NewUtc(int year, int month, int day, int hour, int minute, double seconds)
|
|
{
|
|
DateTime result = new DateTime (g_date_time_new_utc(year, month, day, hour, minute, seconds));
|
|
return result;
|
|
}
|
|
|
|
delegate IntPtr d_g_date_time_ref(IntPtr raw);
|
|
static d_g_date_time_ref g_date_time_ref = Marshal.GetDelegateForFunctionPointer<d_g_date_time_ref>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_ref"));
|
|
|
|
protected override void Ref (IntPtr raw)
|
|
{
|
|
if (!Owned) {
|
|
g_date_time_ref (raw);
|
|
Owned = true;
|
|
}
|
|
}
|
|
|
|
delegate void d_g_date_time_unref(IntPtr raw);
|
|
static d_g_date_time_unref g_date_time_unref = Marshal.GetDelegateForFunctionPointer<d_g_date_time_unref>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_date_time_unref"));
|
|
|
|
protected override void Unref (IntPtr raw)
|
|
{
|
|
if (Owned) {
|
|
g_date_time_unref (raw);
|
|
Owned = false;
|
|
}
|
|
}
|
|
|
|
class FinalizerInfo {
|
|
IntPtr handle;
|
|
|
|
public FinalizerInfo (IntPtr handle)
|
|
{
|
|
this.handle = handle;
|
|
}
|
|
|
|
public bool Handler ()
|
|
{
|
|
g_date_time_unref (handle);
|
|
return false;
|
|
}
|
|
}
|
|
|
|
~DateTime ()
|
|
{
|
|
if (!Owned)
|
|
return;
|
|
FinalizerInfo info = new FinalizerInfo (Handle);
|
|
GLib.Timeout.Add (50, new GLib.TimeoutHandler (info.Handler));
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|