1// Package glib was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package glib
3
4import (
5 "structs"
6 "unsafe"
7
8 "github.com/ebitengine/purego"
9
10 "github.com/bnema/puregotk/pkg/core"
11 "github.com/bnema/puregotk/v4/gobject/types"
12)
13
14// `GDateTime` is a structure that combines a Gregorian date and time
15// into a single structure.
16//
17// `GDateTime` provides many conversion and methods to manipulate dates and times.
18// Time precision is provided down to microseconds and the time can range
19// (proleptically) from 0001-01-01 00:00:00 to 9999-12-31 23:59:59.999999.
20// `GDateTime` follows POSIX time in the sense that it is oblivious to leap
21// seconds.
22//
23// `GDateTime` is an immutable object; once it has been created it cannot
24// be modified further. All modifiers will create a new `GDateTime`.
25// Nearly all such functions can fail due to the date or time going out
26// of range, in which case %NULL will be returned.
27//
28// `GDateTime` is reference counted: the reference count is increased by calling
29// [method@GLib.DateTime.ref] and decreased by calling [method@GLib.DateTime.unref].
30// When the reference count drops to 0, the resources allocated by the `GDateTime`
31// structure are released.
32//
33// Many parts of the API may produce non-obvious results. As an
34// example, adding two months to January 31st will yield March 31st
35// whereas adding one month and then one month again will yield either
36// March 28th or March 29th. Also note that adding 24 hours is not
37// always the same as adding one day (since days containing daylight
38// savings time transitions are either 23 or 25 hours in length).
39type DateTime struct {
40 _ structs.HostLayout
41}
42
43var xDateTimeGLibType func() types.GType
44
45func DateTimeGLibType() types.GType {
46 return xDateTimeGLibType()
47}
48
49func (x *DateTime) GoPointer() uintptr {
50 return uintptr(unsafe.Pointer(x))
51}
52
53var xNewDateTime func(*TimeZone, int, int, int, int, int, float64) *DateTime
54
55// Creates a new #GDateTime corresponding to the given date and time in
56// the time zone @tz.
57//
58// The @year must be between 1 and 9999, @month between 1 and 12 and @day
59// between 1 and 28, 29, 30 or 31 depending on the month and the year.
60//
61// @hour must be between 0 and 23 and @minute must be between 0 and 59.
62//
63// @seconds must be at least 0.0 and must be strictly less than 60.0.
64// It will be rounded down to the nearest microsecond.
65//
66// If the given time is not representable in the given time zone (for
67// example, 02:30 on March 14th 2010 in Toronto, due to daylight savings
68// time) then the time will be rounded up to the nearest existing time
69// (in this case, 03:00). If this matters to you then you should verify
70// the return value for containing the same as the numbers you gave.
71//
72// In the case that the given time is ambiguous in the given time zone
73// (for example, 01:30 on November 7th 2010 in Toronto, due to daylight
74// savings time) then the time falling within standard (ie:
75// non-daylight) time is taken.
76//
77// It not considered a programmer error for the values to this function
78// to be out of range, but in the case that they are, the function will
79// return %NULL.
80//
81// You should release the return value by calling g_date_time_unref()
82// when you are done with it.
83func NewDateTime(TzVar *TimeZone, YearVar int, MonthVar int, DayVar int, HourVar int, MinuteVar int, SecondsVar float64) *DateTime {
84
85 cret := xNewDateTime(TzVar, YearVar, MonthVar, DayVar, HourVar, MinuteVar, SecondsVar)
86 return cret
87}
88
89var xNewDateTimeFromIso8601 func(string, *TimeZone) *DateTime
90
91// Creates a #GDateTime corresponding to the given
92// [ISO 8601 formatted string](https://en.wikipedia.org/wiki/ISO_8601)
93// @text. ISO 8601 strings of the form `<date><sep><time><tz>` are supported, with
94// some extensions from [RFC 3339](https://tools.ietf.org/html/rfc3339) as
95// mentioned below.
96//
97// Note that as #GDateTime "is oblivious to leap seconds", leap seconds information
98// in an ISO-8601 string will be ignored, so a `23:59:60` time would be parsed as
99// `23:59:59`.
100//
101// `<sep>` is the separator and can be either 'T', 't' or ' '. The latter two
102// separators are an extension from
103// [RFC 3339](https://tools.ietf.org/html/rfc3339#section-5.6).
104//
105// `<date>` is in the form:
106//
107// - `YYYY-MM-DD` - Year/month/day, e.g. 2016-08-24.
108// - `YYYYMMDD` - Same as above without dividers.
109// - `YYYY-DDD` - Ordinal day where DDD is from 001 to 366, e.g. 2016-237.
110// - `YYYYDDD` - Same as above without dividers.
111// - `YYYY-Www-D` - Week day where ww is from 01 to 52 and D from 1-7,
112// e.g. 2016-W34-3.
113// - `YYYYWwwD` - Same as above without dividers.
114//
115// `<time>` is in the form:
116//
117// - `hh:mm:ss(.sss)` - Hours, minutes, seconds (subseconds), e.g. 22:10:42.123.
118// - `hhmmss(.sss)` - Same as above without dividers.
119//
120// `<tz>` is an optional timezone suffix of the form:
121//
122// - `Z` - UTC.
123// - `+hh:mm` or `-hh:mm` - Offset from UTC in hours and minutes, e.g. +12:00.
124// - `+hh` or `-hh` - Offset from UTC in hours, e.g. +12.
125//
126// If the timezone is not provided in @text it must be provided in @default_tz
127// (this field is otherwise ignored).
128//
129// This call can fail (returning %NULL) if @text is not a valid ISO 8601
130// formatted string.
131//
132// You should release the return value by calling g_date_time_unref()
133// when you are done with it.
134func NewDateTimeFromIso8601(TextVar string, DefaultTzVar *TimeZone) *DateTime {
135
136 cret := xNewDateTimeFromIso8601(TextVar, DefaultTzVar)
137 return cret
138}
139
140var xNewDateTimeFromTimevalLocal func(*TimeVal) *DateTime
141
142// Creates a #GDateTime corresponding to the given #GTimeVal @tv in the
143// local time zone.
144//
145// The time contained in a #GTimeVal is always stored in the form of
146// seconds elapsed since 1970-01-01 00:00:00 UTC, regardless of the
147// local time offset.
148//
149// This call can fail (returning %NULL) if @tv represents a time outside
150// of the supported range of #GDateTime.
151//
152// You should release the return value by calling g_date_time_unref()
153// when you are done with it.
154func NewDateTimeFromTimevalLocal(TvVar *TimeVal) *DateTime {
155
156 cret := xNewDateTimeFromTimevalLocal(TvVar)
157 return cret
158}
159
160var xNewDateTimeFromTimevalUtc func(*TimeVal) *DateTime
161
162// Creates a #GDateTime corresponding to the given #GTimeVal @tv in UTC.
163//
164// The time contained in a #GTimeVal is always stored in the form of
165// seconds elapsed since 1970-01-01 00:00:00 UTC.
166//
167// This call can fail (returning %NULL) if @tv represents a time outside
168// of the supported range of #GDateTime.
169//
170// You should release the return value by calling g_date_time_unref()
171// when you are done with it.
172func NewDateTimeFromTimevalUtc(TvVar *TimeVal) *DateTime {
173
174 cret := xNewDateTimeFromTimevalUtc(TvVar)
175 return cret
176}
177
178var xNewDateTimeFromUnixLocal func(int64) *DateTime
179
180// Creates a #GDateTime corresponding to the given Unix time @t in the
181// local time zone.
182//
183// Unix time is the number of seconds that have elapsed since 1970-01-01
184// 00:00:00 UTC, regardless of the local time offset.
185//
186// This call can fail (returning %NULL) if @t represents a time outside
187// of the supported range of #GDateTime.
188//
189// You should release the return value by calling g_date_time_unref()
190// when you are done with it.
191func NewDateTimeFromUnixLocal(TVar int64) *DateTime {
192
193 cret := xNewDateTimeFromUnixLocal(TVar)
194 return cret
195}
196
197var xNewDateTimeFromUnixLocalUsec func(int64) *DateTime
198
199// Creates a [struct@GLib.DateTime] corresponding to the given Unix time @t in the
200// local time zone.
201//
202// Unix time is the number of microseconds that have elapsed since 1970-01-01
203// 00:00:00 UTC, regardless of the local time offset.
204//
205// This call can fail (returning `NULL`) if @t represents a time outside
206// of the supported range of #GDateTime.
207//
208// You should release the return value by calling [method@GLib.DateTime.unref]
209// when you are done with it.
210func NewDateTimeFromUnixLocalUsec(UsecsVar int64) *DateTime {
211
212 cret := xNewDateTimeFromUnixLocalUsec(UsecsVar)
213 return cret
214}
215
216var xNewDateTimeFromUnixUtc func(int64) *DateTime
217
218// Creates a #GDateTime corresponding to the given Unix time @t in UTC.
219//
220// Unix time is the number of seconds that have elapsed since 1970-01-01
221// 00:00:00 UTC.
222//
223// This call can fail (returning %NULL) if @t represents a time outside
224// of the supported range of #GDateTime.
225//
226// You should release the return value by calling g_date_time_unref()
227// when you are done with it.
228func NewDateTimeFromUnixUtc(TVar int64) *DateTime {
229
230 cret := xNewDateTimeFromUnixUtc(TVar)
231 return cret
232}
233
234var xNewDateTimeFromUnixUtcUsec func(int64) *DateTime
235
236// Creates a [struct@GLib.DateTime] corresponding to the given Unix time @t in UTC.
237//
238// Unix time is the number of microseconds that have elapsed since 1970-01-01
239// 00:00:00 UTC.
240//
241// This call can fail (returning `NULL`) if @t represents a time outside
242// of the supported range of #GDateTime.
243//
244// You should release the return value by calling [method@GLib.DateTime.unref]
245// when you are done with it.
246func NewDateTimeFromUnixUtcUsec(UsecsVar int64) *DateTime {
247
248 cret := xNewDateTimeFromUnixUtcUsec(UsecsVar)
249 return cret
250}
251
252var xNewDateTimeLocal func(int, int, int, int, int, float64) *DateTime
253
254// Creates a new #GDateTime corresponding to the given date and time in
255// the local time zone.
256//
257// This call is equivalent to calling g_date_time_new() with the time
258// zone returned by g_time_zone_new_local().
259func NewDateTimeLocal(YearVar int, MonthVar int, DayVar int, HourVar int, MinuteVar int, SecondsVar float64) *DateTime {
260
261 cret := xNewDateTimeLocal(YearVar, MonthVar, DayVar, HourVar, MinuteVar, SecondsVar)
262 return cret
263}
264
265var xNewDateTimeNow func(*TimeZone) *DateTime
266
267// Creates a #GDateTime corresponding to this exact instant in the given
268// time zone @tz. The time is as accurate as the system allows, to a
269// maximum accuracy of 1 microsecond.
270//
271// This function will always succeed unless GLib is still being used after the
272// year 9999.
273//
274// You should release the return value by calling g_date_time_unref()
275// when you are done with it.
276func NewDateTimeNow(TzVar *TimeZone) *DateTime {
277
278 cret := xNewDateTimeNow(TzVar)
279 return cret
280}
281
282var xNewDateTimeNowLocal func() *DateTime
283
284// Creates a #GDateTime corresponding to this exact instant in the local
285// time zone.
286//
287// This is equivalent to calling g_date_time_new_now() with the time
288// zone returned by g_time_zone_new_local().
289func NewDateTimeNowLocal() *DateTime {
290
291 cret := xNewDateTimeNowLocal()
292 return cret
293}
294
295var xNewDateTimeNowUtc func() *DateTime
296
297// Creates a #GDateTime corresponding to this exact instant in UTC.
298//
299// This is equivalent to calling g_date_time_new_now() with the time
300// zone returned by g_time_zone_new_utc().
301func NewDateTimeNowUtc() *DateTime {
302
303 cret := xNewDateTimeNowUtc()
304 return cret
305}
306
307var xNewDateTimeUtc func(int, int, int, int, int, float64) *DateTime
308
309// Creates a new #GDateTime corresponding to the given date and time in
310// UTC.
311//
312// This call is equivalent to calling g_date_time_new() with the time
313// zone returned by g_time_zone_new_utc().
314func NewDateTimeUtc(YearVar int, MonthVar int, DayVar int, HourVar int, MinuteVar int, SecondsVar float64) *DateTime {
315
316 cret := xNewDateTimeUtc(YearVar, MonthVar, DayVar, HourVar, MinuteVar, SecondsVar)
317 return cret
318}
319
320var xDateTimeAdd func(uintptr, TimeSpan) *DateTime
321
322// Creates a copy of @datetime and adds the specified timespan to the copy.
323func (x *DateTime) Add(TimespanVar TimeSpan) *DateTime {
324
325 cret := xDateTimeAdd(x.GoPointer(), TimespanVar)
326 return cret
327}
328
329var xDateTimeAddDays func(uintptr, int) *DateTime
330
331// Creates a copy of @datetime and adds the specified number of days to the
332// copy. Add negative values to subtract days.
333func (x *DateTime) AddDays(DaysVar int) *DateTime {
334
335 cret := xDateTimeAddDays(x.GoPointer(), DaysVar)
336 return cret
337}
338
339var xDateTimeAddFull func(uintptr, int, int, int, int, int, float64) *DateTime
340
341// Creates a new #GDateTime adding the specified values to the current date and
342// time in @datetime. Add negative values to subtract.
343func (x *DateTime) AddFull(YearsVar int, MonthsVar int, DaysVar int, HoursVar int, MinutesVar int, SecondsVar float64) *DateTime {
344
345 cret := xDateTimeAddFull(x.GoPointer(), YearsVar, MonthsVar, DaysVar, HoursVar, MinutesVar, SecondsVar)
346 return cret
347}
348
349var xDateTimeAddHours func(uintptr, int) *DateTime
350
351// Creates a copy of @datetime and adds the specified number of hours.
352// Add negative values to subtract hours.
353func (x *DateTime) AddHours(HoursVar int) *DateTime {
354
355 cret := xDateTimeAddHours(x.GoPointer(), HoursVar)
356 return cret
357}
358
359var xDateTimeAddMinutes func(uintptr, int) *DateTime
360
361// Creates a copy of @datetime adding the specified number of minutes.
362// Add negative values to subtract minutes.
363func (x *DateTime) AddMinutes(MinutesVar int) *DateTime {
364
365 cret := xDateTimeAddMinutes(x.GoPointer(), MinutesVar)
366 return cret
367}
368
369var xDateTimeAddMonths func(uintptr, int) *DateTime
370
371// Creates a copy of @datetime and adds the specified number of months to the
372// copy. Add negative values to subtract months.
373//
374// The day of the month of the resulting #GDateTime is clamped to the number
375// of days in the updated calendar month. For example, if adding 1 month to
376// 31st January 2018, the result would be 28th February 2018. In 2020 (a leap
377// year), the result would be 29th February.
378func (x *DateTime) AddMonths(MonthsVar int) *DateTime {
379
380 cret := xDateTimeAddMonths(x.GoPointer(), MonthsVar)
381 return cret
382}
383
384var xDateTimeAddSeconds func(uintptr, float64) *DateTime
385
386// Creates a copy of @datetime and adds the specified number of seconds.
387// Add negative values to subtract seconds.
388func (x *DateTime) AddSeconds(SecondsVar float64) *DateTime {
389
390 cret := xDateTimeAddSeconds(x.GoPointer(), SecondsVar)
391 return cret
392}
393
394var xDateTimeAddWeeks func(uintptr, int) *DateTime
395
396// Creates a copy of @datetime and adds the specified number of weeks to the
397// copy. Add negative values to subtract weeks.
398func (x *DateTime) AddWeeks(WeeksVar int) *DateTime {
399
400 cret := xDateTimeAddWeeks(x.GoPointer(), WeeksVar)
401 return cret
402}
403
404var xDateTimeAddYears func(uintptr, int) *DateTime
405
406// Creates a copy of @datetime and adds the specified number of years to the
407// copy. Add negative values to subtract years.
408//
409// As with g_date_time_add_months(), if the resulting date would be 29th
410// February on a non-leap year, the day will be clamped to 28th February.
411func (x *DateTime) AddYears(YearsVar int) *DateTime {
412
413 cret := xDateTimeAddYears(x.GoPointer(), YearsVar)
414 return cret
415}
416
417var xDateTimeCompare func(uintptr, uintptr) int
418
419// A comparison function for #GDateTimes that is suitable
420// as a #GCompareFunc. Both #GDateTimes must be non-%NULL.
421func (x *DateTime) Compare(Dt2Var uintptr) int {
422
423 cret := xDateTimeCompare(x.GoPointer(), Dt2Var)
424 return cret
425}
426
427var xDateTimeDifference func(uintptr, *DateTime) TimeSpan
428
429// Calculates the difference in time between @end and @begin. The
430// #GTimeSpan that is returned is effectively @end - @begin (ie:
431// positive if the first parameter is larger).
432func (x *DateTime) Difference(BeginVar *DateTime) TimeSpan {
433
434 cret := xDateTimeDifference(x.GoPointer(), BeginVar)
435 return cret
436}
437
438var xDateTimeEqual func(uintptr, uintptr) bool
439
440// Checks to see if @dt1 and @dt2 are equal.
441//
442// Equal here means that they represent the same moment after converting
443// them to the same time zone.
444func (x *DateTime) Equal(Dt2Var uintptr) bool {
445
446 cret := xDateTimeEqual(x.GoPointer(), Dt2Var)
447 return cret
448}
449
450var xDateTimeFormat func(uintptr, string) string
451
452// Creates a newly allocated string representing the requested @format.
453//
454// The format strings understood by this function are a subset of the
455// `strftime()` format language as specified by C99. The `%D`, `%U` and `%W`
456// conversions are not supported, nor is the `E` modifier. The GNU
457// extensions `%k`, `%l`, `%s` and `%P` are supported, however, as are the
458// `0`, `_` and `-` modifiers. The Python extension `%f` is also supported.
459//
460// In contrast to `strftime()`, this function always produces a UTF-8
461// string, regardless of the current locale. Note that the rendering of
462// many formats is locale-dependent and may not match the `strftime()`
463// output exactly.
464//
465// The following format specifiers are supported:
466//
467// - `%a`: the abbreviated weekday name according to the current locale
468// - `%A`: the full weekday name according to the current locale
469// - `%b`: the abbreviated month name according to the current locale
470// - `%B`: the full month name according to the current locale
471// - `%c`: the preferred date and time representation for the current locale
472// - `%C`: the century number (year/100) as a 2-digit integer (00-99)
473// - `%d`: the day of the month as a decimal number (range 01 to 31)
474// - `%e`: the day of the month as a decimal number (range 1 to 31);
475// single digits are preceded by a figure space (U+2007)
476// - `%F`: equivalent to `%Y-%m-%d` (the ISO 8601 date format)
477// - `%g`: the last two digits of the ISO 8601 week-based year as a
478// decimal number (00-99). This works well with `%V` and `%u`.
479// - `%G`: the ISO 8601 week-based year as a decimal number. This works
480// well with `%V` and `%u`.
481// - `%h`: equivalent to `%b`
482// - `%H`: the hour as a decimal number using a 24-hour clock (range 00 to 23)
483// - `%I`: the hour as a decimal number using a 12-hour clock (range 01 to 12)
484// - `%j`: the day of the year as a decimal number (range 001 to 366)
485// - `%k`: the hour (24-hour clock) as a decimal number (range 0 to 23);
486// single digits are preceded by a figure space (U+2007)
487// - `%l`: the hour (12-hour clock) as a decimal number (range 1 to 12);
488// single digits are preceded by a figure space (U+2007)
489// - `%m`: the month as a decimal number (range 01 to 12)
490// - `%M`: the minute as a decimal number (range 00 to 59)
491// - `%f`: the microsecond as a decimal number (range 000000 to 999999)
492// - `%p`: either ‘AM’ or ‘PM’ according to the given time value, or the
493// corresponding strings for the current locale. Noon is treated as
494// ‘PM’ and midnight as ‘AM’. Use of this format specifier is discouraged, as
495// many locales have no concept of AM/PM formatting. Use `%c` or `%X` instead.
496// - `%P`: like `%p` but lowercase: ‘am’ or ‘pm’ or a corresponding string for
497// the current locale. Use of this format specifier is discouraged, as
498// many locales have no concept of AM/PM formatting. Use `%c` or `%X` instead.
499// - `%r`: the time in a.m. or p.m. notation. Use of this format specifier is
500// discouraged, as many locales have no concept of AM/PM formatting. Use `%c`
501// or `%X` instead.
502// - `%R`: the time in 24-hour notation (`%H:%M`)
503// - `%s`: the number of seconds since the Epoch, that is, since 1970-01-01
504// 00:00:00 UTC
505// - `%S`: the second as a decimal number (range 00 to 60)
506// - `%t`: a tab character
507// - `%T`: the time in 24-hour notation with seconds (`%H:%M:%S`)
508// - `%u`: the ISO 8601 standard day of the week as a decimal, range 1 to 7,
509// Monday being 1. This works well with `%G` and `%V`.
510// - `%V`: the ISO 8601 standard week number of the current year as a decimal
511// number, range 01 to 53, where week 1 is the first week that has at
512// least 4 days in the new year. See g_date_time_get_week_of_year().
513// This works well with `%G` and `%u`.
514// - `%w`: the day of the week as a decimal, range 0 to 6, Sunday being 0.
515// This is not the ISO 8601 standard format — use `%u` instead.
516// - `%x`: the preferred date representation for the current locale without
517// the time
518// - `%X`: the preferred time representation for the current locale without
519// the date
520// - `%y`: the year as a decimal number without the century
521// - `%Y`: the year as a decimal number including the century
522// - `%z`: the time zone as an offset from UTC (`+hhmm`)
523// - `%:z`: the time zone as an offset from UTC (`+hh:mm`).
524// This is a gnulib `strftime()` extension. Since: 2.38
525// - `%::z`: the time zone as an offset from UTC (`+hh:mm:ss`). This is a
526// gnulib `strftime()` extension. Since: 2.38
527// - `%:::z`: the time zone as an offset from UTC, with `:` to necessary
528// precision (e.g., `-04`, `+05:30`). This is a gnulib `strftime()` extension. Since: 2.38
529// - `%Z`: the time zone or name or abbreviation
530// - `%%`: a literal `%` character
531//
532// Some conversion specifications can be modified by preceding the
533// conversion specifier by one or more modifier characters.
534//
535// The following modifiers are supported for many of the numeric
536// conversions:
537//
538// - `O`: Use alternative numeric symbols, if the current locale supports those.
539// - `_`: Pad a numeric result with spaces. This overrides the default padding
540// for the specifier.
541// - `-`: Do not pad a numeric result. This overrides the default padding
542// for the specifier.
543// - `0`: Pad a numeric result with zeros. This overrides the default padding
544// for the specifier.
545//
546// The following modifiers are supported for many of the alphabetic conversions:
547//
548// - `^`: Use upper case if possible. This is a gnulib `strftime()` extension.
549// Since: 2.80
550// - `#`: Use opposite case if possible. This is a gnulib `strftime()`
551// extension. Since: 2.80
552//
553// Additionally, when `O` is used with `B`, `b`, or `h`, it produces the alternative
554// form of a month name. The alternative form should be used when the month
555// name is used without a day number (e.g., standalone). It is required in
556// some languages (Baltic, Slavic, Greek, and more) due to their grammatical
557// rules. For other languages there is no difference. `%OB` is a GNU and BSD
558// `strftime()` extension expected to be added to the future POSIX specification,
559// `%Ob` and `%Oh` are GNU `strftime()` extensions. Since: 2.56
560//
561// Since GLib 2.80, when `E` is used with `%c`, `%C`, `%x`, `%X`, `%y` or `%Y`,
562// the date is formatted using an alternate era representation specific to the
563// locale. This is typically used for the Thai solar calendar or Japanese era
564// names, for example.
565//
566// - `%Ec`: the preferred date and time representation for the current locale,
567// using the alternate era representation
568// - `%EC`: the name of the era
569// - `%Ex`: the preferred date representation for the current locale without
570// the time, using the alternate era representation
571// - `%EX`: the preferred time representation for the current locale without
572// the date, using the alternate era representation
573// - `%Ey`: the year since the beginning of the era denoted by the `%EC`
574// specifier
575// - `%EY`: the full alternative year representation
576func (x *DateTime) Format(FormatVar string) string {
577
578 cret := xDateTimeFormat(x.GoPointer(), FormatVar)
579 return cret
580}
581
582var xDateTimeFormatIso8601 func(uintptr) string
583
584// Format @datetime in [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601),
585// including the date, time and time zone, and return that as a UTF-8 encoded
586// string.
587//
588// Since GLib 2.66, this will output to sub-second precision if needed.
589func (x *DateTime) FormatIso8601() string {
590
591 cret := xDateTimeFormatIso8601(x.GoPointer())
592 return cret
593}
594
595var xDateTimeGetDayOfMonth func(uintptr) int
596
597// Retrieves the day of the month represented by @datetime in the gregorian
598// calendar.
599func (x *DateTime) GetDayOfMonth() int {
600
601 cret := xDateTimeGetDayOfMonth(x.GoPointer())
602 return cret
603}
604
605var xDateTimeGetDayOfWeek func(uintptr) int
606
607// Retrieves the ISO 8601 day of the week on which @datetime falls (1 is
608// Monday, 2 is Tuesday... 7 is Sunday).
609func (x *DateTime) GetDayOfWeek() int {
610
611 cret := xDateTimeGetDayOfWeek(x.GoPointer())
612 return cret
613}
614
615var xDateTimeGetDayOfYear func(uintptr) int
616
617// Retrieves the day of the year represented by @datetime in the Gregorian
618// calendar.
619func (x *DateTime) GetDayOfYear() int {
620
621 cret := xDateTimeGetDayOfYear(x.GoPointer())
622 return cret
623}
624
625var xDateTimeGetHour func(uintptr) int
626
627// Retrieves the hour of the day represented by @datetime
628func (x *DateTime) GetHour() int {
629
630 cret := xDateTimeGetHour(x.GoPointer())
631 return cret
632}
633
634var xDateTimeGetMicrosecond func(uintptr) int
635
636// Retrieves the microsecond of the date represented by @datetime
637func (x *DateTime) GetMicrosecond() int {
638
639 cret := xDateTimeGetMicrosecond(x.GoPointer())
640 return cret
641}
642
643var xDateTimeGetMinute func(uintptr) int
644
645// Retrieves the minute of the hour represented by @datetime
646func (x *DateTime) GetMinute() int {
647
648 cret := xDateTimeGetMinute(x.GoPointer())
649 return cret
650}
651
652var xDateTimeGetMonth func(uintptr) int
653
654// Retrieves the month of the year represented by @datetime in the Gregorian
655// calendar.
656func (x *DateTime) GetMonth() int {
657
658 cret := xDateTimeGetMonth(x.GoPointer())
659 return cret
660}
661
662var xDateTimeGetSecond func(uintptr) int
663
664// Retrieves the second of the minute represented by @datetime
665func (x *DateTime) GetSecond() int {
666
667 cret := xDateTimeGetSecond(x.GoPointer())
668 return cret
669}
670
671var xDateTimeGetSeconds func(uintptr) float64
672
673// Retrieves the number of seconds since the start of the last minute,
674// including the fractional part.
675func (x *DateTime) GetSeconds() float64 {
676
677 cret := xDateTimeGetSeconds(x.GoPointer())
678 return cret
679}
680
681var xDateTimeGetTimezone func(uintptr) *TimeZone
682
683// Get the time zone for this @datetime.
684func (x *DateTime) GetTimezone() *TimeZone {
685
686 cret := xDateTimeGetTimezone(x.GoPointer())
687 return cret
688}
689
690var xDateTimeGetTimezoneAbbreviation func(uintptr) string
691
692// Determines the time zone abbreviation to be used at the time and in
693// the time zone of @datetime.
694//
695// For example, in Toronto this is currently "EST" during the winter
696// months and "EDT" during the summer months when daylight savings
697// time is in effect.
698func (x *DateTime) GetTimezoneAbbreviation() string {
699
700 cret := xDateTimeGetTimezoneAbbreviation(x.GoPointer())
701 return cret
702}
703
704var xDateTimeGetUtcOffset func(uintptr) TimeSpan
705
706// Determines the offset to UTC in effect at the time and in the time
707// zone of @datetime.
708//
709// The offset is the number of microseconds that you add to UTC time to
710// arrive at local time for the time zone (ie: negative numbers for time
711// zones west of GMT, positive numbers for east).
712//
713// If @datetime represents UTC time, then the offset is always zero.
714func (x *DateTime) GetUtcOffset() TimeSpan {
715
716 cret := xDateTimeGetUtcOffset(x.GoPointer())
717 return cret
718}
719
720var xDateTimeGetWeekNumberingYear func(uintptr) int
721
722// Returns the ISO 8601 week-numbering year in which the week containing
723// @datetime falls.
724//
725// This function, taken together with g_date_time_get_week_of_year() and
726// g_date_time_get_day_of_week() can be used to determine the full ISO
727// week date on which @datetime falls.
728//
729// This is usually equal to the normal Gregorian year (as returned by
730// g_date_time_get_year()), except as detailed below:
731//
732// For Thursday, the week-numbering year is always equal to the usual
733// calendar year. For other days, the number is such that every day
734// within a complete week (Monday to Sunday) is contained within the
735// same week-numbering year.
736//
737// For Monday, Tuesday and Wednesday occurring near the end of the year,
738// this may mean that the week-numbering year is one greater than the
739// calendar year (so that these days have the same week-numbering year
740// as the Thursday occurring early in the next year).
741//
742// For Friday, Saturday and Sunday occurring near the start of the year,
743// this may mean that the week-numbering year is one less than the
744// calendar year (so that these days have the same week-numbering year
745// as the Thursday occurring late in the previous year).
746//
747// An equivalent description is that the week-numbering year is equal to
748// the calendar year containing the majority of the days in the current
749// week (Monday to Sunday).
750//
751// Note that January 1 0001 in the proleptic Gregorian calendar is a
752// Monday, so this function never returns 0.
753func (x *DateTime) GetWeekNumberingYear() int {
754
755 cret := xDateTimeGetWeekNumberingYear(x.GoPointer())
756 return cret
757}
758
759var xDateTimeGetWeekOfYear func(uintptr) int
760
761// Returns the ISO 8601 week number for the week containing @datetime.
762// The ISO 8601 week number is the same for every day of the week (from
763// Moday through Sunday). That can produce some unusual results
764// (described below).
765//
766// The first week of the year is week 1. This is the week that contains
767// the first Thursday of the year. Equivalently, this is the first week
768// that has more than 4 of its days falling within the calendar year.
769//
770// The value 0 is never returned by this function. Days contained
771// within a year but occurring before the first ISO 8601 week of that
772// year are considered as being contained in the last week of the
773// previous year. Similarly, the final days of a calendar year may be
774// considered as being part of the first ISO 8601 week of the next year
775// if 4 or more days of that week are contained within the new year.
776func (x *DateTime) GetWeekOfYear() int {
777
778 cret := xDateTimeGetWeekOfYear(x.GoPointer())
779 return cret
780}
781
782var xDateTimeGetYear func(uintptr) int
783
784// Retrieves the year represented by @datetime in the Gregorian calendar.
785func (x *DateTime) GetYear() int {
786
787 cret := xDateTimeGetYear(x.GoPointer())
788 return cret
789}
790
791var xDateTimeGetYmd func(uintptr, *int, *int, *int)
792
793// Retrieves the Gregorian day, month, and year of a given #GDateTime.
794func (x *DateTime) GetYmd(YearVar *int, MonthVar *int, DayVar *int) {
795
796 xDateTimeGetYmd(x.GoPointer(), YearVar, MonthVar, DayVar)
797
798}
799
800var xDateTimeHash func(uintptr) uint
801
802// Hashes @datetime into a #guint, suitable for use within #GHashTable.
803func (x *DateTime) Hash() uint {
804
805 cret := xDateTimeHash(x.GoPointer())
806 return cret
807}
808
809var xDateTimeIsDaylightSavings func(uintptr) bool
810
811// Determines if daylight savings time is in effect at the time and in
812// the time zone of @datetime.
813func (x *DateTime) IsDaylightSavings() bool {
814
815 cret := xDateTimeIsDaylightSavings(x.GoPointer())
816 return cret
817}
818
819var xDateTimeRef func(uintptr) *DateTime
820
821// Atomically increments the reference count of @datetime by one.
822func (x *DateTime) Ref() *DateTime {
823
824 cret := xDateTimeRef(x.GoPointer())
825 return cret
826}
827
828var xDateTimeToLocal func(uintptr) *DateTime
829
830// Creates a new #GDateTime corresponding to the same instant in time as
831// @datetime, but in the local time zone.
832//
833// This call is equivalent to calling g_date_time_to_timezone() with the
834// time zone returned by g_time_zone_new_local().
835func (x *DateTime) ToLocal() *DateTime {
836
837 cret := xDateTimeToLocal(x.GoPointer())
838 return cret
839}
840
841var xDateTimeToTimeval func(uintptr, *TimeVal) bool
842
843// Stores the instant in time that @datetime represents into @tv.
844//
845// The time contained in a #GTimeVal is always stored in the form of
846// seconds elapsed since 1970-01-01 00:00:00 UTC, regardless of the time
847// zone associated with @datetime.
848//
849// On systems where 'long' is 32bit (ie: all 32bit systems and all
850// Windows systems), a #GTimeVal is incapable of storing the entire
851// range of values that #GDateTime is capable of expressing. On those
852// systems, this function returns %FALSE to indicate that the time is
853// out of range.
854//
855// On systems where 'long' is 64bit, this function never fails.
856func (x *DateTime) ToTimeval(TvVar *TimeVal) bool {
857
858 cret := xDateTimeToTimeval(x.GoPointer(), TvVar)
859 return cret
860}
861
862var xDateTimeToTimezone func(uintptr, *TimeZone) *DateTime
863
864// Create a new #GDateTime corresponding to the same instant in time as
865// @datetime, but in the time zone @tz.
866//
867// This call can fail in the case that the time goes out of bounds. For
868// example, converting 0001-01-01 00:00:00 UTC to a time zone west of
869// Greenwich will fail (due to the year 0 being out of range).
870func (x *DateTime) ToTimezone(TzVar *TimeZone) *DateTime {
871
872 cret := xDateTimeToTimezone(x.GoPointer(), TzVar)
873 return cret
874}
875
876var xDateTimeToUnix func(uintptr) int64
877
878// Gives the Unix time corresponding to @datetime, rounding down to the
879// nearest second.
880//
881// Unix time is the number of seconds that have elapsed since 1970-01-01
882// 00:00:00 UTC, regardless of the time zone associated with @datetime.
883func (x *DateTime) ToUnix() int64 {
884
885 cret := xDateTimeToUnix(x.GoPointer())
886 return cret
887}
888
889var xDateTimeToUnixUsec func(uintptr) int64
890
891// Gives the Unix time corresponding to @datetime, in microseconds.
892//
893// Unix time is the number of microseconds that have elapsed since 1970-01-01
894// 00:00:00 UTC, regardless of the time zone associated with @datetime.
895func (x *DateTime) ToUnixUsec() int64 {
896
897 cret := xDateTimeToUnixUsec(x.GoPointer())
898 return cret
899}
900
901var xDateTimeToUtc func(uintptr) *DateTime
902
903// Creates a new #GDateTime corresponding to the same instant in time as
904// @datetime, but in UTC.
905//
906// This call is equivalent to calling g_date_time_to_timezone() with the
907// time zone returned by g_time_zone_new_utc().
908func (x *DateTime) ToUtc() *DateTime {
909
910 cret := xDateTimeToUtc(x.GoPointer())
911 return cret
912}
913
914var xDateTimeUnref func(uintptr)
915
916// Atomically decrements the reference count of @datetime by one.
917//
918// When the reference count reaches zero, the resources allocated by
919// @datetime are freed
920func (x *DateTime) Unref() {
921
922 xDateTimeUnref(x.GoPointer())
923
924}
925
926// A value representing an interval of time, in microseconds.
927type TimeSpan = int64
928
929const (
930 // Evaluates to a time span of one day.
931 TIME_SPAN_DAY int64 = 86400000000
932 // Evaluates to a time span of one hour.
933 TIME_SPAN_HOUR int64 = 3600000000
934 // Evaluates to a time span of one millisecond.
935 TIME_SPAN_MILLISECOND int64 = 1000
936 // Evaluates to a time span of one minute.
937 TIME_SPAN_MINUTE int64 = 60000000
938 // Evaluates to a time span of one second.
939 TIME_SPAN_SECOND int64 = 1000000
940)
941
942func init() {
943 core.SetPackageName("GLIB", "glib-2.0")
944 core.SetSharedLibraries("GLIB", []string{"libgobject-2.0.so.0", "libglib-2.0.so.0"})
945 var libs []uintptr
946 for _, libPath := range core.GetPaths("GLIB") {
947 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
948 if err != nil {
949 panic(err)
950 }
951 libs = append(libs, lib)
952 }
953
954 core.PuregoSafeRegister(&xDateTimeGLibType, libs, "g_date_time_get_type")
955
956 core.PuregoSafeRegister(&xNewDateTime, libs, "g_date_time_new")
957 core.PuregoSafeRegister(&xNewDateTimeFromIso8601, libs, "g_date_time_new_from_iso8601")
958 core.PuregoSafeRegister(&xNewDateTimeFromTimevalLocal, libs, "g_date_time_new_from_timeval_local")
959 core.PuregoSafeRegister(&xNewDateTimeFromTimevalUtc, libs, "g_date_time_new_from_timeval_utc")
960 core.PuregoSafeRegister(&xNewDateTimeFromUnixLocal, libs, "g_date_time_new_from_unix_local")
961 core.PuregoSafeRegister(&xNewDateTimeFromUnixLocalUsec, libs, "g_date_time_new_from_unix_local_usec")
962 core.PuregoSafeRegister(&xNewDateTimeFromUnixUtc, libs, "g_date_time_new_from_unix_utc")
963 core.PuregoSafeRegister(&xNewDateTimeFromUnixUtcUsec, libs, "g_date_time_new_from_unix_utc_usec")
964 core.PuregoSafeRegister(&xNewDateTimeLocal, libs, "g_date_time_new_local")
965 core.PuregoSafeRegister(&xNewDateTimeNow, libs, "g_date_time_new_now")
966 core.PuregoSafeRegister(&xNewDateTimeNowLocal, libs, "g_date_time_new_now_local")
967 core.PuregoSafeRegister(&xNewDateTimeNowUtc, libs, "g_date_time_new_now_utc")
968 core.PuregoSafeRegister(&xNewDateTimeUtc, libs, "g_date_time_new_utc")
969
970 core.PuregoSafeRegister(&xDateTimeAdd, libs, "g_date_time_add")
971 core.PuregoSafeRegister(&xDateTimeAddDays, libs, "g_date_time_add_days")
972 core.PuregoSafeRegister(&xDateTimeAddFull, libs, "g_date_time_add_full")
973 core.PuregoSafeRegister(&xDateTimeAddHours, libs, "g_date_time_add_hours")
974 core.PuregoSafeRegister(&xDateTimeAddMinutes, libs, "g_date_time_add_minutes")
975 core.PuregoSafeRegister(&xDateTimeAddMonths, libs, "g_date_time_add_months")
976 core.PuregoSafeRegister(&xDateTimeAddSeconds, libs, "g_date_time_add_seconds")
977 core.PuregoSafeRegister(&xDateTimeAddWeeks, libs, "g_date_time_add_weeks")
978 core.PuregoSafeRegister(&xDateTimeAddYears, libs, "g_date_time_add_years")
979 core.PuregoSafeRegister(&xDateTimeCompare, libs, "g_date_time_compare")
980 core.PuregoSafeRegister(&xDateTimeDifference, libs, "g_date_time_difference")
981 core.PuregoSafeRegister(&xDateTimeEqual, libs, "g_date_time_equal")
982 core.PuregoSafeRegister(&xDateTimeFormat, libs, "g_date_time_format")
983 core.PuregoSafeRegister(&xDateTimeFormatIso8601, libs, "g_date_time_format_iso8601")
984 core.PuregoSafeRegister(&xDateTimeGetDayOfMonth, libs, "g_date_time_get_day_of_month")
985 core.PuregoSafeRegister(&xDateTimeGetDayOfWeek, libs, "g_date_time_get_day_of_week")
986 core.PuregoSafeRegister(&xDateTimeGetDayOfYear, libs, "g_date_time_get_day_of_year")
987 core.PuregoSafeRegister(&xDateTimeGetHour, libs, "g_date_time_get_hour")
988 core.PuregoSafeRegister(&xDateTimeGetMicrosecond, libs, "g_date_time_get_microsecond")
989 core.PuregoSafeRegister(&xDateTimeGetMinute, libs, "g_date_time_get_minute")
990 core.PuregoSafeRegister(&xDateTimeGetMonth, libs, "g_date_time_get_month")
991 core.PuregoSafeRegister(&xDateTimeGetSecond, libs, "g_date_time_get_second")
992 core.PuregoSafeRegister(&xDateTimeGetSeconds, libs, "g_date_time_get_seconds")
993 core.PuregoSafeRegister(&xDateTimeGetTimezone, libs, "g_date_time_get_timezone")
994 core.PuregoSafeRegister(&xDateTimeGetTimezoneAbbreviation, libs, "g_date_time_get_timezone_abbreviation")
995 core.PuregoSafeRegister(&xDateTimeGetUtcOffset, libs, "g_date_time_get_utc_offset")
996 core.PuregoSafeRegister(&xDateTimeGetWeekNumberingYear, libs, "g_date_time_get_week_numbering_year")
997 core.PuregoSafeRegister(&xDateTimeGetWeekOfYear, libs, "g_date_time_get_week_of_year")
998 core.PuregoSafeRegister(&xDateTimeGetYear, libs, "g_date_time_get_year")
999 core.PuregoSafeRegister(&xDateTimeGetYmd, libs, "g_date_time_get_ymd")
1000 core.PuregoSafeRegister(&xDateTimeHash, libs, "g_date_time_hash")
1001 core.PuregoSafeRegister(&xDateTimeIsDaylightSavings, libs, "g_date_time_is_daylight_savings")
1002 core.PuregoSafeRegister(&xDateTimeRef, libs, "g_date_time_ref")
1003 core.PuregoSafeRegister(&xDateTimeToLocal, libs, "g_date_time_to_local")
1004 core.PuregoSafeRegister(&xDateTimeToTimeval, libs, "g_date_time_to_timeval")
1005 core.PuregoSafeRegister(&xDateTimeToTimezone, libs, "g_date_time_to_timezone")
1006 core.PuregoSafeRegister(&xDateTimeToUnix, libs, "g_date_time_to_unix")
1007 core.PuregoSafeRegister(&xDateTimeToUnixUsec, libs, "g_date_time_to_unix_usec")
1008 core.PuregoSafeRegister(&xDateTimeToUtc, libs, "g_date_time_to_utc")
1009 core.PuregoSafeRegister(&xDateTimeUnref, libs, "g_date_time_unref")
1010
1011}