]> git.saurik.com Git - wxWidgets.git/blame - include/wx/datetime.h
TIFF code 1.
[wxWidgets.git] / include / wx / datetime.h
CommitLineData
0979c962
VZ
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/datetime.h
3// Purpose: declarations of time/date related classes (wxDateTime,
4// wxTimeSpan)
5// Author: Vadim Zeitlin
6// Modified by:
7// Created: 10.02.99
8// RCS-ID: $Id$
9// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
10// Licence: wxWindows license
11/////////////////////////////////////////////////////////////////////////////
12
13#ifndef _WX_TIME_H
14#define _WX_TIME_H
15
16#ifdef __GNUG__
17 #pragma interface "datetime.h"
18#endif
19
20#include <time.h>
21
22#include "wx/longlong.h"
23
24class WXDLLEXPORT wxDateTime;
25class WXDLLEXPORT wxTimeSpan;
26class WXDLLEXPORT wxDateSpan;
27
28/*
29 * TODO Well, everything :-)
30 *
31 * 1. Time zones with minutes (make wxTimeZone a class)
32 * 2. getdate() function like under Solaris
33 * 3. text conversion for wxDateSpan
34 */
35
36/*
37 The three classes declared in this header represent:
38
39 1. An absolute moment in the time (wxDateTime)
40 2. A difference between two moments in the time, positive or negative
41 (wxTimeSpan)
42 3. A logical difference between two dates expressed in
43 years/months/weeks/days (wxDateSpan)
44
45 The following arithmetic operations are permitted (all others are not):
46
47 addition
48 --------
49
50 wxDateTime + wxTimeSpan = wxDateTime
51 wxDateTime + wxDateSpan = wxDateTime
52 wxTimeSpan + wxTimeSpan = wxTimeSpan
53 wxDateSpan + wxDateSpan = wxDateSpan
54
55 substraction
56 ------------
57 wxDateTime - wxDateTime = wxTimeSpan
58 wxTimeSpan - wxTimeSpan = wxTimeSpan
59 wxDateSpan - wxDateSpan = wxDateSpan
60
61 multiplication
62 --------------
63 wxTimeSpan * number = wxTimeSpan
64 wxDateSpan * number = wxDateSpan
65
66 unitary minus
67 -------------
68 -wxTimeSpan = wxTimeSpan
69 -wxDateSpan = wxDateSpan
70*/
71
72// ----------------------------------------------------------------------------
73// This class represents an absolute moment in the time
74// ----------------------------------------------------------------------------
75class WXDLLEXPORT wxDateTime
76{
77public:
78 // types
79 // ------------------------------------------------------------------------
80
81 // a small unsigned integer type for storing things like seconds, days
82 // of the week, &c. It should be at least short (i.e. not char) to
83 // contain the number of milliseconds - it may also be 'int' because
84 // there is no size penalty associated with it in our code, we don't
85 // store any data in this format
86 typedef unsigned short wxDateTime_t;
87
88 // the timezones
89 enum TimeZone
90 {
91 // the time in the current time zone
92 Local,
93
94 // zones from GMT (= Greenwhich Mean Time): they're guaranteed to be
95 // consequent numbers, so writing something like `GMT0 + offset' is
96 // safe if abs(offset) <= 12
97
98 // underscore stands for minus
99 GMT_12, GMT_11, GMT_10, GMT_9, GMT_8, GMT_7,
100 GMT_6, GMT_5, GMT_4, GMT_3, GMT_2, GMT_1,
101 GMT0,
102 GMT1, GMT2, GMT3, GMT4, GMT5, GMT6,
103 GMT7, GMT8, GMT9, GMT10, GMT11, GMT12,
104 // Note that GMT12 and GMT_12 are not the same: there is a difference
105 // of exactly one day between them
106
107 // Universal Coordinated Time
108 UTC = GMT0
109
110 // TODO add symbolic names for TZ (EST, MET, ...)?
111 };
112
113 // the calendar systems we know about: notice that it's valid (for
114 // this classes purpose anyhow) to work with any of these calendars
115 // even with the dates before the historical appearance of the
116 // calendar
117 enum Calendar
118 {
119 Gregorian, // current calendar
120 Julian // calendar in use since -45 until the 1582 (or later)
121
122 // TODO Hebrew, Chinese, Maya, ... (just kidding) (or then may be not?)
123 };
124
125 // these values only are used to identify the different dates of
126 // adoption of the Gregorian calendar (see IsGregorian())
127 //
128 // All data and comments taken verbatim from "The Calendar FAQ (v 2.0)"
129