]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_datetime.i
SWIGged
[wxWidgets.git] / wxPython / src / _datetime.i
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: _datetime.i
3 // Purpose: SWIG interface for wxDateTime and etc.
4 //
5 // Author: Robin Dunn
6 //
7 // Created: 25-Nov-1998
8 // RCS-ID: $Id$
9 // Copyright: (c) 2003 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
12
13 // Not a %module
14
15
16 //---------------------------------------------------------------------------
17 %newgroup
18
19 %{
20 #include <wx/datetime.h>
21 %}
22
23 MAKE_CONST_WXSTRING(DefaultDateTimeFormat);
24 MAKE_CONST_WXSTRING(DefaultTimeSpanFormat);
25
26 //---------------------------------------------------------------------------
27
28
29 %typemap(in) wxDateTime::TimeZone& (bool temp=false) {
30 $1 = new wxDateTime::TimeZone((wxDateTime::TZ)PyInt_AsLong($input));
31 temp = true;
32 }
33 %typemap(freearg) wxDateTime::TimeZone& {
34 if (temp$argnum) delete $1;
35 }
36
37
38 %{
39 #define LOCAL_TZ wxDateTime::Local
40 %}
41
42
43 // Convert a wxLongLong to a Python Long by getting the hi/lo dwords, then
44 // shifting and oring them together
45 %typemap(out) wxLongLong {
46 PyObject *hi, *lo, *shifter, *shifted;
47 hi = PyLong_FromLong( $1.GetHi() );
48 lo = PyLong_FromLong( $1.GetLo() );
49 shifter = PyLong_FromLong(32);
50 shifted = PyNumber_Lshift(hi, shifter);
51 $result = PyNumber_Or(shifted, lo);
52 Py_DECREF(hi);
53 Py_DECREF(lo);
54 Py_DECREF(shifter);
55 Py_DECREF(shifted);
56 }
57
58
59 //---------------------------------------------------------------------------
60
61 //typedef unsigned short wxDateTime_t;
62 #define wxDateTime_t int
63
64 // wxDateTime represents an absolute moment in the time
65 class wxDateTime {
66 public:
67
68 enum TZ
69 {
70 // the time in the current time zone
71 Local,
72
73 // zones from GMT (= Greenwhich Mean Time): they're guaranteed to be
74 // consequent numbers, so writing something like `GMT0 + offset' is
75 // safe if abs(offset) <= 12
76 // underscore stands for minus
77 GMT_12, GMT_11, GMT_10, GMT_9, GMT_8, GMT_7,
78 GMT_6, GMT_5, GMT_4, GMT_3, GMT_2, GMT_1,
79 GMT0,
80 GMT1, GMT2, GMT3, GMT4, GMT5, GMT6,
81 GMT7, GMT8, GMT9, GMT10, GMT11, GMT12, GMT13,
82
83 // Europe
84 WET = GMT0, // Western Europe Time
85 WEST = GMT1, // Western Europe Summer Time
86 CET = GMT1, // Central Europe Time
87 CEST = GMT2, // Central Europe Summer Time
88 EET = GMT2, // Eastern Europe Time
89 EEST = GMT3, // Eastern Europe Summer Time
90 MSK = GMT3, // Moscow Time
91 MSD = GMT4, // Moscow Summer Time
92
93 // US and Canada
94 AST = GMT_4, // Atlantic Standard Time
95 ADT = GMT_3, // Atlantic Daylight Time
96 EST = GMT_5, // Eastern Standard Time
97 EDT = GMT_4, // Eastern Daylight Saving Time
98 CST = GMT_6, // Central Standard Time
99 CDT = GMT_5, // Central Daylight Saving Time
100 MST = GMT_7, // Mountain Standard Time
101 MDT = GMT_6, // Mountain Daylight Saving Time
102 PST = GMT_8, // Pacific Standard Time
103 PDT = GMT_7, // Pacific Daylight Saving Time
104 HST = GMT_10, // Hawaiian Standard Time
105 AKST = GMT_9, // Alaska Standard Time
106 AKDT = GMT_8, // Alaska Daylight Saving Time
107
108 // Australia
109
110 A_WST = GMT8, // Western Standard Time
111 A_CST = GMT13 + 1, // Central Standard Time (+9.5)
112 A_EST = GMT10, // Eastern Standard Time
113 A_ESST = GMT11, // Eastern Summer Time
114
115 // New Zealand
116 NZST = GMT12, // Standard Time
117 NZDT = GMT13, // Daylight Saving Time
118
119 // Universal Coordinated Time = the new and politically correct name
120 // for GMT
121 UTC = GMT0
122 };
123
124
125 // the calendar systems we know about: notice that it's valid (for
126 // this classes purpose anyhow) to work with any of these calendars
127 // even with the dates before the historical appearance of the
128 // calendar
129 enum Calendar
130 {
131 Gregorian, // current calendar
132 Julian // calendar in use since -45 until the 1582 (or later)
133 };
134
135 // these values only are used to identify the different dates of
136 // adoption of the Gregorian calendar (see IsGregorian())
137 //
138 // All data and comments taken verbatim from "The Calendar FAQ (v 2.0)"
139 // by Claus Tøndering, http://www.pip.dknet.dk/~c-t/calendar.html
140 // except for the comments "we take".
141 //
142 // Symbol "->" should be read as "was followed by" in the comments
143 // which follow.
144 enum GregorianAdoption
145 {
146 Gr_Unknown, // no data for this country or it's too uncertain to use
147 Gr_Standard, // on the day 0 of Gregorian calendar: 15 Oct 1582
148
149 Gr_Alaska, // Oct 1867 when Alaska became part of the USA
150 Gr_Albania, // Dec 1912
151
152 Gr_Austria = Gr_Unknown, // Different regions on different dates
153 Gr_Austria_Brixen, // 5 Oct 1583 -> 16 Oct 1583
154 Gr_Austria_Salzburg = Gr_Austria_Brixen,
155 Gr_Austria_Tyrol = Gr_Austria_Brixen,
156 Gr_Austria_Carinthia, // 14 Dec 1583 -> 25 Dec 1583
157 Gr_Austria_Styria = Gr_Austria_Carinthia,
158
159 Gr_Belgium, // Then part of the Netherlands
160
161 Gr_Bulgaria = Gr_Unknown, // Unknown precisely (from 1915 to 1920)
162 Gr_Bulgaria_1, // 18 Mar 1916 -> 1 Apr 1916
163 Gr_Bulgaria_2, // 31 Mar 1916 -> 14 Apr 1916
164 Gr_Bulgaria_3, // 3 Sep 1920 -> 17 Sep 1920
165
166 Gr_Canada = Gr_Unknown, // Different regions followed the changes in
167 // Great Britain or France
168
169 Gr_China = Gr_Unknown, // Different authorities say:
170 Gr_China_1, // 18 Dec 1911 -> 1 Jan 1912
171 Gr_China_2, // 18 Dec 1928 -> 1 Jan 1929
172
173 Gr_Czechoslovakia, // (Bohemia and Moravia) 6 Jan 1584 -> 17 Jan 1584
174 Gr_Denmark, // (including Norway) 18 Feb 1700 -> 1 Mar 1700
175 Gr_Egypt, // 1875
176 Gr_Estonia, // 1918
177 Gr_Finland, // Then part of Sweden
178
179 Gr_France, // 9 Dec 1582 -> 20 Dec 1582
180 Gr_France_Alsace, // 4 Feb 1682 -> 16 Feb 1682
181 Gr_France_Lorraine, // 16 Feb 1760 -> 28 Feb 1760
182 Gr_France_Strasbourg, // February 1682
183
184 Gr_Germany = Gr_Unknown, // Different states on different dates:
185 Gr_Germany_Catholic, // 1583-1585 (we take 1584)
186 Gr_Germany_Prussia, // 22 Aug 1610 -> 2 Sep 1610
187 Gr_Germany_Protestant, // 18 Feb 1700 -> 1 Mar 1700
188
189 Gr_GreatBritain, // 2 Sep 1752 -> 14 Sep 1752 (use 'cal(1)')
190
191 Gr_Greece, // 9 Mar 1924 -> 23 Mar 1924
192 Gr_Hungary, // 21 Oct 1587 -> 1 Nov 1587
193 Gr_Ireland = Gr_GreatBritain,
194 Gr_Italy = Gr_Standard,
195
196 Gr_Japan = Gr_Unknown, // Different authorities say:
197 Gr_Japan_1, // 19 Dec 1872 -> 1 Jan 1873
198 Gr_Japan_2, // 19 Dec 1892 -> 1 Jan 1893
199 Gr_Japan_3, // 18 Dec 1918 -> 1 Jan 1919
200
201 Gr_Latvia, // 1915-1918 (we take 1915)
202 Gr_Lithuania, // 1915
203 Gr_Luxemburg, // 14 Dec 1582 -> 25 Dec 1582
204 Gr_Netherlands = Gr_Belgium, // (including Belgium) 1 Jan 1583
205
206 // this is too weird to take into account: the Gregorian calendar was
207 // introduced twice in Groningen, first time 28 Feb 1583 was followed
208 // by 11 Mar 1583, then it has gone back to Julian in the summer of
209 // 1584 and then 13 Dec 1700 -> 12 Jan 1701 - which is
210 // the date we take here
211 Gr_Netherlands_Groningen, // 13 Dec 1700 -> 12 Jan 1701
212 Gr_Netherlands_Gelderland, // 30 Jun 1700 -> 12 Jul 1700
213 Gr_Netherlands_Utrecht, // (and Overijssel) 30 Nov 1700->12 Dec 1700
214 Gr_Netherlands_Friesland, // (and Drenthe) 31 Dec 1700 -> 12 Jan 1701
215
216 Gr_Norway = Gr_Denmark, // Then part of Denmark
217 Gr_Poland = Gr_Standard,
218 Gr_Portugal = Gr_Standard,
219 Gr_Romania, // 31 Mar 1919 -> 14 Apr 1919
220 Gr_Russia, // 31 Jan 1918 -> 14 Feb 1918
221 Gr_Scotland = Gr_GreatBritain,
222 Gr_Spain = Gr_Standard,
223
224 // Sweden has a curious history. Sweden decided to make a gradual
225 // change from the Julian to the Gregorian calendar. By dropping every
226 // leap year from 1700 through 1740 the eleven superfluous days would
227 // be omitted and from 1 Mar 1740 they would be in sync with the
228 // Gregorian calendar. (But in the meantime they would be in sync with
229 // nobody!)
230 //
231 // So 1700 (which should have been a leap year in the Julian calendar)
232 // was not a leap year in Sweden. However, by mistake 1704 and 1708
233 // became leap years. This left Sweden out of synchronisation with
234 // both the Julian and the Gregorian world, so they decided to go back
235 // to the Julian calendar. In order to do this, they inserted an extra
236 // day in 1712, making that year a double leap year! So in 1712,
237 // February had 30 days in Sweden.
238 //
239 // Later, in 1753, Sweden changed to the Gregorian calendar by
240 // dropping 11 days like everyone else.
241 Gr_Sweden = Gr_Finland, // 17 Feb 1753 -> 1 Mar 1753
242
243 Gr_Switzerland = Gr_Unknown,// Different cantons used different dates
244 Gr_Switzerland_Catholic, // 1583, 1584 or 1597 (we take 1584)
245 Gr_Switzerland_Protestant, // 31 Dec 1700 -> 12 Jan 1701
246
247 Gr_Turkey, // 1 Jan 1927
248 Gr_USA = Gr_GreatBritain,
249 Gr_Wales = Gr_GreatBritain,
250 Gr_Yugoslavia // 1919
251 };
252
253
254
255 // the country parameter is used so far for calculating the start and
256 // the end of DST period and for deciding whether the date is a work
257 // day or not
258 enum Country
259 {
260 Country_Unknown, // no special information for this country
261 Country_Default, // set the default country with SetCountry() method
262 // or use the default country with any other
263
264 // Western European countries: we assume that they all follow the same
265 // DST rules (True or False?)
266 Country_WesternEurope_Start,
267 Country_EEC = Country_WesternEurope_Start,
268 France,
269 Germany,
270 UK,
271 Country_WesternEurope_End = UK,
272
273 Russia,
274
275 USA
276 };
277
278 // symbolic names for the months
279 enum Month
280 {
281 Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec, Inv_Month
282 };
283
284 // symbolic names for the weekdays
285 enum WeekDay
286 {
287 Sun, Mon, Tue, Wed, Thu, Fri, Sat, Inv_WeekDay
288 };
289
290 // invalid value for the year
291 enum Year
292 {
293 Inv_Year = SHRT_MIN // should hold in wxDateTime_t
294 };
295
296 // flags for GetWeekDayName and GetMonthName
297 enum NameFlags
298 {
299 Name_Full = 0x01, // return full name
300 Name_Abbr = 0x02 // return abbreviated name
301 };
302
303 // flags for GetWeekOfYear and GetWeekOfMonth
304 enum WeekFlags
305 {
306 Default_First, // Sunday_First for US, Monday_First for the rest
307 Monday_First, // week starts with a Monday
308 Sunday_First // week starts with a Sunday
309 };
310
311
312 //** Nested class TimeZone is handled by a typemap instead
313
314 //** Is nested class Tm needed?
315
316
317 // static methods
318 // ------------------------------------------------------------------------
319
320 // set the current country
321 static void SetCountry(Country country);
322
323 // get the current country
324 static Country GetCountry();
325
326 // return True if the country is a West European one (in practice,
327 // this means that the same DST rules as for EEC apply)
328 static bool IsWestEuropeanCountry(Country country = Country_Default);
329
330 // return the current year
331 static int GetCurrentYear(Calendar cal = Gregorian);
332
333 // convert the year as returned by wxDateTime::GetYear() to a year
334 // suitable for BC/AD notation. The difference is that BC year 1
335 // corresponds to the year 0 (while BC year 0 didn't exist) and AD
336 // year N is just year N.
337 static int ConvertYearToBC(int year);
338
339 // return the current month
340 static Month GetCurrentMonth(Calendar cal = Gregorian);
341
342 // returns True if the given year is a leap year in the given calendar
343 static bool IsLeapYear(int year = Inv_Year, Calendar cal = Gregorian);
344
345 // get the century (19 for 1999, 20 for 2000 and -5 for 492 BC)
346 static int GetCentury(int year = Inv_Year);
347
348 // returns the number of days in this year (356 or 355 for Gregorian
349 // calendar usually :-)
350 %Rename(GetNumberOfDaysinYear,
351 static wxDateTime_t, GetNumberOfDays(int year, Calendar cal = Gregorian));
352
353 // get the number of the days in the given month (default value for
354 // the year means the current one)
355 %Rename(GetNumberOfDaysInMonth,
356 static wxDateTime_t, GetNumberOfDays(Month month,
357 int year = Inv_Year,
358 Calendar cal = Gregorian));
359
360 // get the full (default) or abbreviated month name in the current
361 // locale, returns empty string on error
362 static wxString GetMonthName(Month month,
363 NameFlags flags = Name_Full);
364
365 // get the full (default) or abbreviated weekday name in the current
366 // locale, returns empty string on error
367 static wxString GetWeekDayName(WeekDay weekday,
368 NameFlags flags = Name_Full);
369
370 %extend {
371 DocAStr(
372 GetAmPmStrings,
373 "GetAmPmStrings() -> (am, pm)",
374 "Get the AM and PM strings in the current locale (may be empty)", "");
375 static PyObject* GetAmPmStrings() {
376 wxString am;
377 wxString pm;
378 wxDateTime::GetAmPmStrings(&am, &pm);
379 wxPyBlock_t blocked = wxPyBeginBlockThreads();
380 PyObject* tup = PyTuple_New(2);
381 PyTuple_SET_ITEM(tup, 0, wx2PyString(am));
382 PyTuple_SET_ITEM(tup, 1, wx2PyString(pm));
383 wxPyEndBlockThreads(blocked);
384 return tup;
385 }
386 }
387
388 // return True if the given country uses DST for this year
389 static bool IsDSTApplicable(int year = Inv_Year,
390 Country country = Country_Default);
391
392 // get the beginning of DST for this year, will return invalid object
393 // if no DST applicable in this year. The default value of the
394 // parameter means to take the current year.
395 static wxDateTime GetBeginDST(int year = Inv_Year,
396 Country country = Country_Default);
397 // get the end of DST for this year, will return invalid object
398 // if no DST applicable in this year. The default value of the
399 // parameter means to take the current year.
400 static wxDateTime GetEndDST(int year = Inv_Year,
401 Country country = Country_Default);
402
403 // return the wxDateTime object for the current time
404 static inline wxDateTime Now();
405
406 // return the wxDateTime object for the current time with millisecond
407 // precision (if available on this platform)
408 static wxDateTime UNow();
409
410 // return the wxDateTime object for today midnight: i.e. as Now() but
411 // with time set to 0
412 static inline wxDateTime Today();
413
414
415
416 // ------------------------------------------------------------------------
417 // constructors
418
419 wxDateTime();
420 %RenameCtor(DateTimeFromTimeT, wxDateTime(time_t timet));
421 %RenameCtor(DateTimeFromJDN, wxDateTime(double jdn));
422 %RenameCtor(DateTimeFromHMS, wxDateTime(wxDateTime_t hour,
423 wxDateTime_t minute = 0,
424 wxDateTime_t second = 0,
425 wxDateTime_t millisec = 0));
426 %RenameCtor(DateTimeFromDMY, wxDateTime(wxDateTime_t day,
427 Month month = Inv_Month,
428 int year = Inv_Year,
429 wxDateTime_t hour = 0,
430 wxDateTime_t minute = 0,
431 wxDateTime_t second = 0,
432 wxDateTime_t millisec = 0));
433 %RenameCtor(DateTimeFromDateTime, wxDateTime(const wxDateTime& date));
434
435 ~wxDateTime();
436
437 // ------------------------------------------------------------------------
438 // Set methods
439
440 wxDateTime& SetToCurrent();
441
442 // set to given time_t value
443 %Rename(SetTimeT, wxDateTime&, Set(time_t timet));
444
445 // set to given JDN (beware of rounding errors)
446 %Rename(SetJDN, wxDateTime&, Set(double jdn));
447
448 // set to given time, date = today
449 %Rename(SetHMS, wxDateTime&, Set(wxDateTime_t hour,
450 wxDateTime_t minute = 0,
451 wxDateTime_t second = 0,
452 wxDateTime_t millisec = 0));
453
454 // from separate values for each component with explicit date
455 // (defaults for month and year are the current values)
456 wxDateTime& Set(wxDateTime_t day,
457 Month month = Inv_Month,
458 int year = Inv_Year, // 1999, not 99 please!
459 wxDateTime_t hour = 0,
460 wxDateTime_t minute = 0,
461 wxDateTime_t second = 0,
462 wxDateTime_t millisec = 0);
463
464 // resets time to 00:00:00, doesn't change the date
465 wxDateTime& ResetTime();
466
467 // the following functions don't change the values of the other
468 // fields, i.e. SetMinute() won't change either hour or seconds value
469
470 // set the year
471 wxDateTime& SetYear(int year);
472 // set the month
473 wxDateTime& SetMonth(Month month);
474 // set the day of the month
475 wxDateTime& SetDay(wxDateTime_t day);
476 // set hour
477 wxDateTime& SetHour(wxDateTime_t hour);
478 // set minute
479 wxDateTime& SetMinute(wxDateTime_t minute);
480 // set second
481 wxDateTime& SetSecond(wxDateTime_t second);
482 // set millisecond
483 wxDateTime& SetMillisecond(wxDateTime_t millisecond);
484
485
486 // ------------------------------------------------------------------------
487 // calendar calculations
488
489 // set to the given week day in the same week as this one
490 wxDateTime& SetToWeekDayInSameWeek(WeekDay weekday, WeekFlags flags = Monday_First);
491 wxDateTime GetWeekDayInSameWeek(WeekDay weekday, WeekFlags flags = Monday_First);
492
493 // set to the next week day following this one
494 wxDateTime& SetToNextWeekDay(WeekDay weekday);
495 wxDateTime GetNextWeekDay(WeekDay weekday);
496
497 // set to the previous week day before this one
498 wxDateTime& SetToPrevWeekDay(WeekDay weekday);
499 wxDateTime GetPrevWeekDay(WeekDay weekday);
500
501 // set to Nth occurence of given weekday in the given month of the
502 // given year (time is set to 0), return True on success and False on
503 // failure. n may be positive (1..5) or negative to count from the end
504 // of the month (see helper function SetToLastWeekDay())
505 bool SetToWeekDay(WeekDay weekday,
506 int n = 1,
507 Month month = Inv_Month,
508 int year = Inv_Year);
509 // wxDateTime GetWeekDay(WeekDay weekday,
510 // int n = 1,
511 // Month month = Inv_Month,
512 // int year = Inv_Year);
513
514 // sets to the last weekday in the given month, year
515 bool SetToLastWeekDay(WeekDay weekday,
516 Month month = Inv_Month,
517 int year = Inv_Year);
518 wxDateTime GetLastWeekDay(WeekDay weekday,
519 Month month = Inv_Month,
520 int year = Inv_Year);
521
522 // sets the date to the given day of the given week in the year,
523 // returns True on success and False if given date doesn't exist (e.g.
524 // numWeek is > 53)
525 bool SetToTheWeek(wxDateTime_t numWeek, WeekDay weekday = Mon, WeekFlags flags = Monday_First);
526 wxDateTime GetWeek(wxDateTime_t numWeek, WeekDay weekday = Mon, WeekFlags flags = Monday_First);
527
528 %pythoncode {
529 SetToTheWeek = wx._deprecated(SetToTheWeek, "SetToTheWeek is deprecated, use (static) SetToWeekOfYear instead")
530 GetWeek = wx._deprecated(GetWeek, "GetWeek is deprecated, use GetWeekOfYear instead")
531 }
532
533 // returns the date corresponding to the given week day of the given
534 // week (in ISO notation) of the specified year
535 static wxDateTime SetToWeekOfYear(int year,
536 wxDateTime_t numWeek,
537 WeekDay weekday = Mon);
538
539 // sets the date to the last day of the given (or current) month or the
540 // given (or current) year
541 wxDateTime& SetToLastMonthDay(Month month = Inv_Month,
542 int year = Inv_Year);
543 wxDateTime GetLastMonthDay(Month month = Inv_Month,
544 int year = Inv_Year);
545
546 // sets to the given year day (1..365 or 366)
547 wxDateTime& SetToYearDay(wxDateTime_t yday);
548 wxDateTime GetYearDay(wxDateTime_t yday);
549
550 // The definitions below were taken verbatim from
551 //
552 // http://www.capecod.net/~pbaum/date/date0.htm
553 //
554 // (Peter Baum's home page)
555 //
556 // definition: The Julian Day Number, Julian Day, or JD of a
557 // particular instant of time is the number of days and fractions of a
558 // day since 12 hours Universal Time (Greenwich mean noon) on January
559 // 1 of the year -4712, where the year is given in the Julian
560 // proleptic calendar. The idea of using this reference date was
561 // originally proposed by Joseph Scalizer in 1582 to count years but
562 // it was modified by 19th century astronomers to count days. One
563 // could have equivalently defined the reference time to be noon of
564 // November 24, -4713 if were understood that Gregorian calendar rules
565 // were applied. Julian days are Julian Day Numbers and are not to be
566 // confused with Julian dates.
567 //
568 // definition: The Rata Die number is a date specified as the number
569 // of days relative to a base date of December 31 of the year 0. Thus
570 // January 1 of the year 1 is Rata Die day 1.
571
572 // get the Julian Day number (the fractional part specifies the time of
573 // the day, related to noon - beware of rounding errors!)
574 double GetJulianDayNumber();
575 double GetJDN();
576
577 // get the Modified Julian Day number: it is equal to JDN - 2400000.5
578 // and so integral MJDs correspond to the midnights (and not noons).
579 // MJD 0 is Nov 17, 1858
580 double GetModifiedJulianDayNumber() const { return GetJDN() - 2400000.5; }
581 double GetMJD();
582
583 // get the Rata Die number
584 double GetRataDie();
585
586
587 // ------------------------------------------------------------------------
588 // timezone stuff
589
590 // transform to any given timezone
591 wxDateTime ToTimezone(const wxDateTime::TimeZone& tz, bool noDST = false);
592 wxDateTime& MakeTimezone(const wxDateTime::TimeZone& tz, bool noDST = false);
593
594 // interpret current value as being in another timezone and transform
595 // it to local one
596 wxDateTime FromTimezone(const wxDateTime::TimeZone& tz, bool noDST = false) const;
597 wxDateTime& MakeFromTimezone(const wxDateTime::TimeZone& tz, bool noDST = false);
598
599 // transform to/from GMT/UTC
600 wxDateTime ToUTC(bool noDST = false) const;
601 wxDateTime& MakeUTC(bool noDST = false);
602
603 wxDateTime ToGMT(bool noDST = false) const;
604 wxDateTime& MakeGMT(bool noDST = false);
605
606 wxDateTime FromUTC(bool noDST = false) const;
607 wxDateTime& MakeFromUTC(bool noDST = false);
608
609
610 // is daylight savings time in effect at this moment according to the
611 // rules of the specified country?
612 //
613 // Return value is > 0 if DST is in effect, 0 if it is not and -1 if
614 // the information is not available (this is compatible with ANSI C)
615 int IsDST(Country country = Country_Default);
616
617
618
619 // ------------------------------------------------------------------------
620 // accessors
621
622 // is the date valid (True even for non initialized objects)?
623 inline bool IsValid() const;
624 %pythoncode { IsOk = IsValid }
625 %pythoncode { Ok = IsOk }
626
627 %pythoncode { def __nonzero__(self): return self.IsOk() };
628
629
630 // get the number of seconds since the Unix epoch - returns (time_t)-1
631 // if the value is out of range
632 inline time_t GetTicks() const;
633
634 // get the year (returns Inv_Year if date is invalid)
635 int GetYear(const wxDateTime::TimeZone& tz = LOCAL_TZ) const;
636
637 // get the month (Inv_Month if date is invalid)
638 Month GetMonth(const wxDateTime::TimeZone& tz = LOCAL_TZ) const;
639
640 // get the month day (in 1..31 range, 0 if date is invalid)
641 wxDateTime_t GetDay(const wxDateTime::TimeZone& tz = LOCAL_TZ) const;
642
643 // get the day of the week (Inv_WeekDay if date is invalid)
644 WeekDay GetWeekDay(const wxDateTime::TimeZone& tz = LOCAL_TZ) const;
645
646 // get the hour of the day
647 wxDateTime_t GetHour(const wxDateTime::TimeZone& tz = LOCAL_TZ) const;
648
649 // get the minute
650 wxDateTime_t GetMinute(const wxDateTime::TimeZone& tz = LOCAL_TZ) const;
651
652 // get the second
653 wxDateTime_t GetSecond(const wxDateTime::TimeZone& tz = LOCAL_TZ) const;
654
655 // get milliseconds
656 wxDateTime_t GetMillisecond(const wxDateTime::TimeZone& tz = LOCAL_TZ) const;
657
658
659 // get the day since the year start (1..366, 0 if date is invalid)
660 wxDateTime_t GetDayOfYear(const wxDateTime::TimeZone& tz = LOCAL_TZ) const;
661 // get the week number since the year start (1..52 or 53, 0 if date is
662 // invalid)
663 wxDateTime_t GetWeekOfYear(WeekFlags flags = Monday_First,
664 const wxDateTime::TimeZone& tz = LOCAL_TZ) const;
665 // get the week number since the month start (1..5, 0 if date is
666 // invalid)
667 wxDateTime_t GetWeekOfMonth(WeekFlags flags = Monday_First,
668 const wxDateTime::TimeZone& tz = LOCAL_TZ) const;
669
670 // is this date a work day? This depends on a country, of course,
671 // because the holidays are different in different countries
672 bool IsWorkDay(Country country = Country_Default) const;
673
674 // is this date later than Gregorian calendar introduction for the
675 // given country (see enum GregorianAdoption)?
676 //
677 // NB: this function shouldn't be considered as absolute authority in
678 // the matter. Besides, for some countries the exact date of
679 // adoption of the Gregorian calendar is simply unknown.
680 // bool IsGregorianDate(GregorianAdoption country = Gr_Standard) const;
681
682
683 // ------------------------------------------------------------------------
684 // comparison (see also functions below for operator versions)
685
686 // returns True if the two moments are strictly identical
687 inline bool IsEqualTo(const wxDateTime& datetime) const;
688
689 // returns True if the date is strictly earlier than the given one
690 inline bool IsEarlierThan(const wxDateTime& datetime) const;
691
692 // returns True if the date is strictly later than the given one
693 inline bool IsLaterThan(const wxDateTime& datetime) const;
694
695 // returns True if the date is strictly in the given range
696 inline bool IsStrictlyBetween(const wxDateTime& t1,
697 const wxDateTime& t2) const;
698
699 // returns True if the date is in the given range
700 inline bool IsBetween(const wxDateTime& t1, const wxDateTime& t2) const;
701
702 // do these two objects refer to the same date?
703 inline bool IsSameDate(const wxDateTime& dt) const;
704
705 // do these two objects have the same time?
706 inline bool IsSameTime(const wxDateTime& dt) const;
707
708 // are these two objects equal up to given timespan?
709 inline bool IsEqualUpTo(const wxDateTime& dt, const wxTimeSpan& ts) const;
710
711
712 // ------------------------------------------------------------------------
713 // arithmetics with dates (see also below for more operators)
714
715 // add a time span (positive or negative)
716 %Rename(AddTS, wxDateTime&, Add(const wxTimeSpan& diff));
717 // add a date span (positive or negative)
718 %Rename(AddDS, wxDateTime&, Add(const wxDateSpan& diff));
719
720 // subtract a time span (positive or negative)
721 %Rename(SubtractTS, wxDateTime&, Subtract(const wxTimeSpan& diff));
722
723 // subtract a date span (positive or negative)
724 %Rename(SubtractDS, wxDateTime&, Subtract(const wxDateSpan& diff));
725
726 // return the difference between two dates
727 wxTimeSpan Subtract(const wxDateTime& dt) const;
728
729
730 %nokwargs operator+=;
731 // add a time span (positive or negative)
732 inline wxDateTime& operator+=(const wxTimeSpan& diff);
733 // add a date span (positive or negative)
734 inline wxDateTime& operator+=(const wxDateSpan& diff);
735
736 %nokwargs operator-=;
737 // subtract a time span (positive or negative)
738 inline wxDateTime& operator-=(const wxTimeSpan& diff);
739 // subtract a date span (positive or negative)
740 inline wxDateTime& operator-=(const wxDateSpan& diff);
741
742
743 // inline bool operator<(const wxDateTime& dt) const;
744 // inline bool operator<=(const wxDateTime& dt) const;
745 // inline bool operator>(const wxDateTime& dt) const;
746 // inline bool operator>=(const wxDateTime& dt) const;
747 // inline bool operator==(const wxDateTime& dt) const;
748 // inline bool operator!=(const wxDateTime& dt) const;
749
750 %nokwargs __add__;
751 %nokwargs __sub__;
752 %extend {
753 wxDateTime __add__(const wxTimeSpan& other) { return *self + other; }
754 wxDateTime __add__(const wxDateSpan& other) { return *self + other; }
755
756 wxTimeSpan __sub__(const wxDateTime& other) { return *self - other; }
757 wxDateTime __sub__(const wxTimeSpan& other) { return *self - other; }
758 wxDateTime __sub__(const wxDateSpan& other) { return *self - other; }
759
760 // These fall back to just comparing pointers if other is NULL, or if
761 // either operand is invalid. This allows Python comparrisons to None
762 // to not assert and to return a sane value for the compare.
763 bool __lt__(const wxDateTime* other) {
764 if (!other || !self->IsValid() || !other->IsValid()) return self < other;
765 return (*self < *other);
766 }
767 bool __le__(const wxDateTime* other) {
768 if (!other || !self->IsValid() || !other->IsValid()) return self <= other;
769 return (*self <= *other);
770 }
771 bool __gt__(const wxDateTime* other) {
772 if (!other || !self->IsValid() || !other->IsValid()) return self > other;
773 return (*self > *other);
774 }
775 bool __ge__(const wxDateTime* other) {
776 if (!other || !self->IsValid() || !other->IsValid()) return self >= other;
777 return (*self >= *other);
778 }
779
780 bool __eq__(const wxDateTime* other) {
781 if (!other || !self->IsValid() || !other->IsValid()) return self == other;
782 return (*self == *other);
783 }
784 bool __ne__(const wxDateTime* other) {
785 if (!other || !self->IsValid() || !other->IsValid()) return self != other;
786 return (*self != *other);
787 }
788 }
789
790
791
792
793
794 // ------------------------------------------------------------------------
795 // conversion from text: all conversions from text return -1 on failure,
796 // or the index in the string where the next character following the date
797 // specification (i.e. the one where the scan had to stop) is located.
798
799 %extend {
800
801 // parse a string in RFC 822 format (found e.g. in mail headers and
802 // having the form "Wed, 10 Feb 1999 19:07:07 +0100")
803 int ParseRfc822Date(const wxString& date) {
804 const wxChar* rv;
805 const wxChar* _date = date;
806 rv = self->ParseRfc822Date(_date);
807 if (rv == NULL) return -1;
808 return rv - _date;
809 }
810
811
812 // parse a date/time in the given format (see strptime(3)), fill in
813 // the missing (in the string) fields with the values of dateDef (by
814 // default, they will not change if they had valid values or will
815 // default to Today() otherwise)
816 int ParseFormat(const wxString& date,
817 const wxString& format = wxPyDefaultDateTimeFormat,
818 const wxDateTime& dateDef = wxDefaultDateTime) {
819 const wxChar* rv;
820 const wxChar* _date = date;
821 rv = self->ParseFormat(_date, format, dateDef);
822 if (rv == NULL) return -1;
823 return rv - _date;
824 }
825
826 // parse a string containing the date/time in "free" format, this
827 // function will try to make an educated guess at the string contents
828 int ParseDateTime(const wxString& datetime) {
829 const wxChar* rv;
830 const wxChar* _datetime = datetime;
831 rv = self->ParseDateTime(_datetime);
832 if (rv == NULL) return -1;
833 return rv - _datetime;
834 }
835
836
837 // parse a string containing the date only in "free" format (less
838 // flexible than ParseDateTime)
839 int ParseDate(const wxString& date) {
840 const wxChar* rv;
841 const wxChar* _date = date;
842 rv = self->ParseDate(_date);
843 if (rv == NULL) return -1;
844 return rv - _date;
845 }
846
847 // parse a string containing the time only in "free" format
848 int ParseTime(const wxString& time) {
849 const wxChar* rv;
850 const wxChar* _time = time;
851 rv = self->ParseTime(_time);
852 if (rv == NULL) return -1;
853 return rv - _time;
854 }
855 }
856
857
858 // this function accepts strftime()-like format string (default
859 // argument corresponds to the preferred date and time representation
860 // for the current locale) and returns the string containing the
861 // resulting text representation
862 wxString Format(const wxString& format = wxPyDefaultDateTimeFormat,
863 const wxDateTime::TimeZone& tz = LOCAL_TZ) const;
864
865 // preferred date representation for the current locale
866 wxString FormatDate() const;
867
868 // preferred time representation for the current locale
869 wxString FormatTime() const;
870
871 // returns the string representing the date in ISO 8601 format
872 // (YYYY-MM-DD)
873 wxString FormatISODate() const;
874
875 // returns the string representing the time in ISO 8601 format
876 // (HH:MM:SS)
877 wxString FormatISOTime() const;
878
879 %pythoncode {
880 def __repr__(self):
881 if self.IsValid():
882 f = self.Format().encode(wx.GetDefaultPyEncoding())
883 return '<wx.DateTime: \"%s\" at %s>' % ( f, self.this)
884 else:
885 return '<wx.DateTime: \"INVALID\" at %s>' % self.this
886 def __str__(self):
887 if self.IsValid():
888 return self.Format().encode(wx.GetDefaultPyEncoding())
889 else:
890 return "INVALID DateTime"
891 }
892
893 %property(Day, GetDay, SetDay, doc="See `GetDay` and `SetDay`");
894 %property(DayOfYear, GetDayOfYear, doc="See `GetDayOfYear`");
895 %property(Hour, GetHour, SetHour, doc="See `GetHour` and `SetHour`");
896 %property(JDN, GetJDN, SetJDN, doc="See `GetJDN` and `SetJDN`");
897 %property(JulianDayNumber, GetJulianDayNumber, doc="See `GetJulianDayNumber`");
898 %property(LastMonthDay, GetLastMonthDay, doc="See `GetLastMonthDay`");
899 %property(LastWeekDay, GetLastWeekDay, doc="See `GetLastWeekDay`");
900 %property(MJD, GetMJD, doc="See `GetMJD`");
901 %property(Millisecond, GetMillisecond, SetMillisecond, doc="See `GetMillisecond` and `SetMillisecond`");
902 %property(Minute, GetMinute, SetMinute, doc="See `GetMinute` and `SetMinute`");
903 %property(ModifiedJulianDayNumber, GetModifiedJulianDayNumber, doc="See `GetModifiedJulianDayNumber`");
904 %property(Month, GetMonth, SetMonth, doc="See `GetMonth` and `SetMonth`");
905 %property(NextWeekDay, GetNextWeekDay, doc="See `GetNextWeekDay`");
906 %property(PrevWeekDay, GetPrevWeekDay, doc="See `GetPrevWeekDay`");
907 %property(RataDie, GetRataDie, doc="See `GetRataDie`");
908 %property(Second, GetSecond, SetSecond, doc="See `GetSecond` and `SetSecond`");
909 %property(Ticks, GetTicks, doc="See `GetTicks`");
910 %property(Week, GetWeek, doc="See `GetWeek`");
911 %property(WeekDay, GetWeekDay, doc="See `GetWeekDay`");
912 %property(WeekDayInSameWeek, GetWeekDayInSameWeek, doc="See `GetWeekDayInSameWeek`");
913 %property(WeekOfMonth, GetWeekOfMonth, doc="See `GetWeekOfMonth`");
914 %property(WeekOfYear, GetWeekOfYear, doc="See `GetWeekOfYear`");
915 %property(Year, GetYear, SetYear, doc="See `GetYear` and `SetYear`");
916 %property(YearDay, GetYearDay, doc="See `GetYearDay`");
917
918 };
919
920 //---------------------------------------------------------------------------
921 //---------------------------------------------------------------------------
922
923
924 // This class contains a difference between 2 wxDateTime values, so it makes
925 // sense to add it to wxDateTime and it is the result of subtraction of 2
926 // objects of that class. See also wxDateSpan.
927 class wxTimeSpan
928 {
929 public:
930
931 // TODO: Need an input typemap for wxLongLong...
932
933
934 // return the timespan for the given number of milliseconds
935 static wxTimeSpan Milliseconds(/*wxLongLong*/ long ms);
936 static wxTimeSpan Millisecond();
937
938 // return the timespan for the given number of seconds
939 static wxTimeSpan Seconds(/*wxLongLong*/ long sec);
940 static wxTimeSpan Second();
941
942 // return the timespan for the given number of minutes
943 static wxTimeSpan Minutes(long min);
944 static wxTimeSpan Minute();
945
946 // return the timespan for the given number of hours
947 static wxTimeSpan Hours(long hours);
948 static wxTimeSpan Hour();
949
950 // return the timespan for the given number of days
951 static wxTimeSpan Days(long days);
952 static wxTimeSpan Day();
953
954 // return the timespan for the given number of weeks
955 static wxTimeSpan Weeks(long days);
956 static wxTimeSpan Week();
957
958 // ------------------------------------------------------------------------
959 // constructors
960
961 // from separate values for each component, date set to 0 (hours are
962 // not restricted to 0..24 range, neither are minutes, seconds or
963 // milliseconds)
964 wxTimeSpan(long hours = 0,
965 long minutes = 0,
966 /*wxLongLong*/ long seconds = 0,
967 /*wxLongLong*/ long milliseconds = 0);
968
969 ~wxTimeSpan();
970
971 // ------------------------------------------------------------------------
972 // arithmetics with time spans
973
974 // add two timespans together
975 inline wxTimeSpan& Add(const wxTimeSpan& diff);
976
977 // subtract another timespan
978 inline wxTimeSpan& Subtract(const wxTimeSpan& diff);
979
980 // multiply timespan by a scalar
981 inline wxTimeSpan& Multiply(int n);
982
983 // negate the value of the timespan
984 wxTimeSpan& Neg();
985
986 // return the absolute value of the timespan: does _not_ modify the
987 // object
988 inline wxTimeSpan Abs() const;
989
990
991 wxTimeSpan& operator+=(const wxTimeSpan& diff);
992 wxTimeSpan& operator-=(const wxTimeSpan& diff);
993 wxTimeSpan& operator*=(int n);
994 wxTimeSpan& operator-();
995
996 %extend {
997 wxTimeSpan __add__(const wxTimeSpan& other) { return *self + other; }
998 wxTimeSpan __sub__(const wxTimeSpan& other) { return *self - other; }
999 wxTimeSpan __mul__(int n) { return *self * n; }
1000 wxTimeSpan __rmul__(int n) { return n * *self; }
1001
1002 bool __lt__(const wxTimeSpan* other) { return other ? (*self < *other) : false; }
1003 bool __le__(const wxTimeSpan* other) { return other ? (*self <= *other) : false; }
1004 bool __gt__(const wxTimeSpan* other) { return other ? (*self > *other) : true; }
1005 bool __ge__(const wxTimeSpan* other) { return other ? (*self >= *other) : true; }
1006 bool __eq__(const wxTimeSpan* other) { return other ? (*self == *other) : false; }
1007 bool __ne__(const wxTimeSpan* other) { return other ? (*self != *other) : true; }
1008 }
1009
1010
1011
1012 // ------------------------------------------------------------------------
1013
1014 // is the timespan null?
1015 bool IsNull() const;
1016
1017 // is the timespan positive?
1018 bool IsPositive() const;
1019
1020 // is the timespan negative?
1021 bool IsNegative() const;
1022
1023 // are two timespans equal?
1024 inline bool IsEqualTo(const wxTimeSpan& ts) const;
1025
1026 // compare two timestamps: works with the absolute values, i.e. -2
1027 // hours is longer than 1 hour. Also, it will return False if the
1028 // timespans are equal in absolute value.
1029 inline bool IsLongerThan(const wxTimeSpan& ts) const;
1030
1031 // compare two timestamps: works with the absolute values, i.e. 1
1032 // hour is shorter than -2 hours. Also, it will return False if the
1033 // timespans are equal in absolute value.
1034 bool IsShorterThan(const wxTimeSpan& t) const;
1035
1036 // ------------------------------------------------------------------------
1037 // breaking into days, hours, minutes and seconds
1038
1039 // get the max number of weeks in this timespan
1040 inline int GetWeeks() const;
1041 // get the max number of days in this timespan
1042 inline int GetDays() const;
1043 // get the max number of hours in this timespan
1044 inline int GetHours() const;
1045 // get the max number of minutes in this timespan
1046 inline int GetMinutes() const;
1047
1048
1049 // get the max number of seconds in this timespan
1050 inline wxLongLong GetSeconds() const;
1051 // get the number of milliseconds in this timespan
1052 wxLongLong GetMilliseconds() const;
1053
1054 // ------------------------------------------------------------------------
1055 // conversion to text
1056
1057 // this function accepts strftime()-like format string (default
1058 // argument corresponds to the preferred date and time representation
1059 // for the current locale) and returns the string containing the
1060 // resulting text representation. Notice that only some of format
1061 // specifiers valid for wxDateTime are valid for wxTimeSpan: hours,
1062 // minutes and seconds make sense, but not "PM/AM" string for example.
1063 wxString Format(const wxString& format = wxPyDefaultTimeSpanFormat) const;
1064
1065 %pythoncode {
1066 def __repr__(self):
1067 f = self.Format().encode(wx.GetDefaultPyEncoding())
1068 return '<wx.TimeSpan: \"%s\" at %s>' % ( f, self.this)
1069 def __str__(self):
1070 return self.Format().encode(wx.GetDefaultPyEncoding())
1071 }
1072
1073 %property(Days, GetDays, doc="See `GetDays`");
1074 %property(Hours, GetHours, doc="See `GetHours`");
1075 %property(Milliseconds, GetMilliseconds, doc="See `GetMilliseconds`");
1076 %property(Minutes, GetMinutes, doc="See `GetMinutes`");
1077 %property(Seconds, GetSeconds, doc="See `GetSeconds`");
1078 %property(Weeks, GetWeeks, doc="See `GetWeeks`");
1079 };
1080
1081
1082 //---------------------------------------------------------------------------
1083 //---------------------------------------------------------------------------
1084
1085 // This class is a "logical time span" and is useful for implementing program
1086 // logic for such things as "add one month to the date" which, in general,
1087 // doesn't mean to add 60*60*24*31 seconds to it, but to take the same date
1088 // the next month (to understand that this is indeed different consider adding
1089 // one month to Feb, 15 - we want to get Mar, 15, of course).
1090 //
1091 // When adding a month to the date, all lesser components (days, hours, ...)
1092 // won't be changed unless the resulting date would be invalid: for example,
1093 // Jan 31 + 1 month will be Feb 28, not (non existing) Feb 31.
1094 //
1095 // Because of this feature, adding and subtracting back again the same
1096 // wxDateSpan will *not*, in general give back the original date: Feb 28 - 1
1097 // month will be Jan 28, not Jan 31!
1098 //
1099 // wxDateSpan can be either positive or negative. They may be
1100 // multiplied by scalars which multiply all deltas by the scalar: i.e. 2*(1
1101 // month and 1 day) is 2 months and 2 days. They can be added together and
1102 // with wxDateTime or wxTimeSpan, but the type of result is different for each
1103 // case.
1104 //
1105 // Beware about weeks: if you specify both weeks and days, the total number of
1106 // days added will be 7*weeks + days! See also GetTotalDays() function.
1107 //
1108 // Equality operators are defined for wxDateSpans. Two datespans are equal if
1109 // they both give the same target date when added to *every* source date.
1110 // Thus wxDateSpan::Months(1) is not equal to wxDateSpan::Days(30), because
1111 // they not give the same date when added to 1 Feb. But wxDateSpan::Days(14) is
1112 // equal to wxDateSpan::Weeks(2)
1113 //
1114 // Finally, notice that for adding hours, minutes &c you don't need this
1115 // class: wxTimeSpan will do the job because there are no subtleties
1116 // associated with those.
1117 class wxDateSpan
1118 {
1119 public:
1120 // this many years/months/weeks/days
1121 wxDateSpan(int years = 0, int months = 0, int weeks = 0, int days = 0)
1122 {
1123 m_years = years;
1124 m_months = months;
1125 m_weeks = weeks;
1126 m_days = days;
1127 }
1128
1129 ~wxDateSpan();
1130
1131 // get an object for the given number of days
1132 static wxDateSpan Days(int days);
1133 static wxDateSpan Day();
1134
1135 // get an object for the given number of weeks
1136 static wxDateSpan Weeks(int weeks);
1137 static wxDateSpan Week();
1138
1139 // get an object for the given number of months
1140 static wxDateSpan Months(int mon);
1141 static wxDateSpan Month();
1142
1143 // get an object for the given number of years
1144 static wxDateSpan Years(int years);
1145 static wxDateSpan Year();
1146
1147
1148 // ------------------------------------------------------------------------
1149
1150 // set number of years
1151 wxDateSpan& SetYears(int n);
1152 // set number of months
1153 wxDateSpan& SetMonths(int n);
1154 // set number of weeks
1155 wxDateSpan& SetWeeks(int n);
1156 // set number of days
1157 wxDateSpan& SetDays(int n);
1158
1159 // get number of years
1160 int GetYears() const;
1161 // get number of months
1162 int GetMonths() const;
1163 // get number of weeks
1164 int GetWeeks() const;
1165 // get number of days
1166 int GetDays() const;
1167 // returns 7*GetWeeks() + GetDays()
1168 int GetTotalDays() const;
1169
1170
1171 // ------------------------------------------------------------------------
1172
1173 // add another wxDateSpan to us
1174 inline wxDateSpan& Add(const wxDateSpan& other);
1175
1176 // subtract another wxDateSpan from us
1177 inline wxDateSpan& Subtract(const wxDateSpan& other);
1178
1179 // inverse the sign of this timespan
1180 inline wxDateSpan& Neg();
1181
1182 // multiply all components by a (signed) number
1183 inline wxDateSpan& Multiply(int factor);
1184
1185 inline wxDateSpan& operator+=(const wxDateSpan& other);
1186 inline wxDateSpan& operator-=(const wxDateSpan& other);
1187 wxDateSpan& operator-() { return Neg(); }
1188 inline wxDateSpan& operator*=(int factor) { return Multiply(factor); }
1189
1190 %extend {
1191 wxDateSpan __add__(const wxDateSpan& other) { return *self + other; }
1192 wxDateSpan __sub__(const wxDateSpan& other) { return *self - other; }
1193 wxDateSpan __mul__(int n) { return *self * n; }
1194 wxDateSpan __rmul__(int n) { return n * *self; }
1195
1196 // bool __lt__(const wxDateSpan* other) { return other ? (*self < *other) : false; }
1197 // bool __le__(const wxDateSpan* other) { return other ? (*self <= *other) : false; }
1198 // bool __gt__(const wxDateSpan* other) { return other ? (*self > *other) : true; }
1199 // bool __ge__(const wxDateSpan* other) { return other ? (*self >= *other) : true; }
1200
1201 bool __eq__(const wxDateSpan* other) { return other ? (*self == *other) : false; }
1202 bool __ne__(const wxDateSpan* other) { return other ? (*self != *other) : true; }
1203 }
1204
1205 %property(Days, GetDays, SetDays, doc="See `GetDays` and `SetDays`");
1206 %property(Months, GetMonths, SetMonths, doc="See `GetMonths` and `SetMonths`");
1207 %property(TotalDays, GetTotalDays, doc="See `GetTotalDays`");
1208 %property(Weeks, GetWeeks, SetWeeks, doc="See `GetWeeks` and `SetWeeks`");
1209 %property(Years, GetYears, SetYears, doc="See `GetYears` and `SetYears`");
1210 };
1211
1212
1213 //---------------------------------------------------------------------------
1214
1215 // TODO: wxDateTimeHolidayAuthority
1216
1217 //---------------------------------------------------------------------------
1218
1219 long wxGetLocalTime();
1220 long wxGetUTCTime();
1221 long wxGetCurrentTime();
1222 wxLongLong wxGetLocalTimeMillis();
1223
1224 %immutable;
1225 const wxDateTime wxDefaultDateTime;
1226 %mutable;
1227
1228 //---------------------------------------------------------------------------
1229 //---------------------------------------------------------------------------