Update of /cvsroot/monetdb/MonetDB5/src/modules/atoms
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv24307/src/modules/atoms
Modified Files:
Tag: MonetDB_5-4
inet.mx mtime.mx
Log Message:
more texi fixes
Index: inet.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/modules/atoms/inet.mx,v
retrieving revision 1.26.2.1
retrieving revision 1.26.2.2
diff -u -d -r1.26.2.1 -r1.26.2.2
--- inet.mx 5 Feb 2008 22:14:56 -0000 1.26.2.1
+++ inet.mx 5 Feb 2008 22:38:40 -0000 1.26.2.2
@@ -36,6 +36,7 @@
The value nil is represented as (per byte) 0000 0001.
@h
[EMAIL PROTECTED]
typedef struct _inet {
unsigned char q1;
unsigned char q2;
@@ -46,7 +47,7 @@
unsigned char filler2;
unsigned char isnil;
} inet;
-
[EMAIL PROTECTED]
#define in_isnil(i) ((i)->q1 == 0 && (i)->q2 == 0 && (i)->q3 == 0 && (i)->q4
== 0 && (i)->mask == 0 && (i)->isnil != 0)
#define in_setnil(i) (i)->q1 = (i)->q2 = (i)->q3 = (i)->q4 = (i)->mask =
(i)->filler1 = (i)->filler2 = 0; (i)->isnil = 1
Index: mtime.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/modules/atoms/mtime.mx,v
retrieving revision 1.106.2.1
retrieving revision 1.106.2.2
diff -u -d -r1.106.2.1 -r1.106.2.2
--- mtime.mx 5 Feb 2008 22:14:56 -0000 1.106.2.1
+++ mtime.mx 5 Feb 2008 22:38:40 -0000 1.106.2.2
@@ -29,67 +29,76 @@
The starting point of this module are SQL 92 and the ODBC time-related data
types.
Also, some functionalities have been imported from the time classes of the Java
standard library.
[EMAIL PROTECTED]
+
This module introduces four basic types and operations on them:
-\begin{description}
-\item[date] a date in the Gregorian calendar, e.g. 1999-JAN-31
[EMAIL PROTECTED] @samp
[EMAIL PROTECTED] date
+a @samp{date} in the Gregorian calendar, e.g. 1999-JAN-31
-\item[daytime] a time of day to the detail of milliseconds, e.g. 23:59:59:000
[EMAIL PROTECTED] daytime
+a time of day to the detail of milliseconds, e.g. 23:59:59:000
-\item[timestamp] a combination of date and time, indicating an exact point in
[EMAIL PROTECTED] timestamp
+a combination of date and time, indicating an exact point in
time (GMT). GMT is the time at the Greenwich meridian without a daylight
savings
time (DST) regime. Absence of DST means that hours are consecutive (no jumps)
which
makes it easy to perform time difference calculations.
-\item[timezone] the local time is often different from GMT (even at Greenwich
in
+
[EMAIL PROTECTED] timezone
+the local time is often different from GMT (even at Greenwich in
summer, as the UK also has DST). Therefore, whenever a timestamp is composed
from a local daytime and date, a timezone should be specified in order to
translate the local daytime to GMT (and vice versa if a timestamp is to
be decomposed in a local date and daytime).
-There is an additional atom {\bf rule} that is used to define when daylight
[EMAIL PROTECTED] rule
+There is an additional atom @samp{rule} that is used to define when daylight
savings time in a timezone starts and ends. We provide predefined timezone
objects for a number of timezones below (see the init script of this module).
-Also, there is one timezone called the {\bf local timezone}, which can be set
+Also, there is one timezone called the local @samp{timezone}, which can be set
to one global value in a running Monet server, that is used if the timezone
parameter is omitted from a command that needs it (if not set, the default
value
of the local timezone is plain GMT).
-\end{description}
[EMAIL PROTECTED] table
@+ Limitations
[EMAIL PROTECTED]
The valid ranges of the various data types are as follows:
-\begin{description}
-\item[min and max year]
+
[EMAIL PROTECTED] @samp
[EMAIL PROTECTED] min and max year
The maximum and minimum dates and timestamps that can be stored are in the
years 5,867,411 and
-5,867,411, respectively. Interestingly, the year 0 is not a valid year. The
year before 1 is
called -1.
-\item[valid dates]
+
[EMAIL PROTECTED] valid dates
Fall in a valid year, and have a month and day that is valid in that year. The
first day in the year
is January 1, the last December 31. Months with 31 days are January, March,
May, July, August,
October, and December, while April, June, September and November have 30 days.
February has 28
days, expect in a leap year, when it has 29. A leap year is a year that is an
exact multiple of
4. Years that are a multiple of 100 but not of 400 are an exception; they are
no leap years.
-\item[valid daytime]
+
[EMAIL PROTECTED] valid daytime
The smallest daytime is 00:00:00:000 and the largest 23:59:59:999 (the hours
in a daytime
range between [0,23], minutes and seconds between [0,59] and milliseconds
between [0:999]).
Daytime identifies a valid time-of-day, not an amount of time (for denoting
amounts of time, or
time differences, we use here concepts like "number of days" or "number of
milliseconds" denoted
by some value of a standard integer type).
-\item[valid timestamp]
+
[EMAIL PROTECTED] valid timestamp
is formed by a combination of a valid date and valid daytime.
\item[difference in days]
-For difference calculations between dates (in numbers of days) we use signed
integers (the {\tt int}
+For difference calculations between dates (in numbers of days) we use signed
integers (the @i{int}
Monet type), hence the valid range for difference calculations is between
-2147483648 and
2147483647 days (which corresponds to roughly -5,867,411 and 5,867,411 years).
\item[difference in msecs]
-For difference between timestamps (in numbers of milliseconds) we use 64-bit
longs (the {\tt lng} Monet type).
+For difference between timestamps (in numbers of milliseconds) we use 64-bit
longs (the @i{lng} Monet type).
These are large integers of maximally 19 digits, which therefore impose a
limit of about 106,000,000,000 years
on the maximum time difference used in computations.
-\end{description}
[EMAIL PROTECTED] table
There are also conceptual limitations that are inherent to the time system
itself:
-\begin{description}
-\item[Gregorian calendar]
[EMAIL PROTECTED] @samp
[EMAIL PROTECTED] Gregorian calendar
The basics of the Gregorian calendar stem from the time of Julius Caesar,
when the concept of a solar year as consisting of 365.25 days (365 days plus
once
in 4 years one extra day) was introduced. However, this Julian Calendar, made
a year 11
@@ -98,7 +107,7 @@
decree, skipped 11 days. This measure was not adopted in the whole of Europe
immediately,
however. For this reason, there were many regions in Europe that upheld
different dates.
-It was only on {\bf September 14, 1752} that some consensus was reached and
more countries
+It was only on @b{September 14, 1752} that some consensus was reached and more
countries
joined the Gregorian Calendar, which also was last modified at that time. The
modifications
were twofold: first, 12 more days were skipped. Second, it was determined that
the
year starts on January 1 (in England, for instance, it had been starting on
March 25).
@@ -111,8 +120,8 @@
anyway, as explained above). In solar terms, however, this calendar is
reasonably
accurate (see the "correction seconds" note below).
-\item[timezones]
-The basic timezone regime was established on {\bf November 1, 1884} in the
{\em International
[EMAIL PROTECTED] timezones
+The basic timezone regime was established on @b{November 1, 1884} in the
@emph{International
Meridian Conference} held in Greenwich (UK). Before that, a different time
held in almost
any city. The conference established 24 different time zones defined by
regular longitude intervals
that all differed by one hour. Not for long it was that national and political
interest started
@@ -134,14 +143,14 @@
Applications that do not make correct use of timezones, will produce irregular
results
on e.g. time difference calculations.
-\item[correction seconds]
[EMAIL PROTECTED] correction seconds
Once every such hundred years, a correction second is added on new year's
night.
As I do not know the rule, and this rule would seriously complicate this module
(as then the duration of a day, which is now the fixed number of 24*60*60*1000
milliseconds, becomes parametrized by the date), it is not implemented. Hence
these seconds are lost, so time difference calculations in milliseconds
(rather than
in days) have a small error if the time difference spans many hundreds of
years.
-\end{description}
[EMAIL PROTECTED] table
TODO: we cannot handle well changes in the timezone rules (e.g., DST only
exists since
40 years, and some countries make frequent changes to the DST policy). To
accommodate
@@ -152,6 +161,7 @@
@+ Time/date comparison
[EMAIL PROTECTED]
@= compareGrp
command ==(v:@1,w:@1):bit
address [EMAIL PROTECTED]
@@ -203,17 +213,17 @@
command calc.max(v:@1,w:@1):@1
address [EMAIL PROTECTED]
comment "Maximum test for @1 value";
[EMAIL PROTECTED]
@mal
@+ Date atom
[EMAIL PROTECTED]
-Monet atoms can have multiple {\em parse formats}. One of these formats is
-chosen as the {\em print format}.
+Monet atoms can have multiple @emph{parse formats}. One of these formats is
+chosen as the @emph{print format}.
To facilitate date descriptions, many formats are supported when parsing
date atoms from a string, as described by the below grammar.
-{\small
-\begin{verbatim}
+
[EMAIL PROTECTED]
print format: INT_YEAR '-' INT_MONTH '-' INT_DAY
parse format: INT_YEAR SEP1 INT_MONTH SEP1 INT_DAY
or: INT_YEAR SEP2 STR_MONTH SEP2 INT_DAY
@@ -228,8 +238,8 @@
only the first three characters are also allowed)
SEP1 = '-' or '/' or '\' or (' ')+
SEP2 = SEP1 or ''
-\end{verbatim}
-}
[EMAIL PROTECTED] verbatim
+
Printing a date uses the 1999-01-31 format, as this is both language neutral
and the lexicographical string ordering of this representation respects the
actual date ordering.
@@ -250,10 +260,9 @@
@:compareGrp(date)@
@+ Daytime atom
[EMAIL PROTECTED]
A valid time of day to the detail of milliseconds, like 23:59:59:000
-{\small
-\begin{verbatim}
+
[EMAIL PROTECTED]
print format: HOUR ':' MIN ':' SEC '.' MSEC
parse format: HOUR ':' MIN ':' SEC SEP MSEC
or: HOUR ':' MIN ':' SEC
@@ -264,8 +273,8 @@
SEC = integer between 0 and 59 (default = 0)
MSEC = integer between 0 and 999 (default = 0)
SEP = '.' or ':'
-\end{verbatim}
-}
[EMAIL PROTECTED] verbatim
+
@mal
atom daytime :int;
command fromstr():daytime
@@ -276,21 +285,20 @@
@:compareGrp(daytime)@
@+ Timestamp
[EMAIL PROTECTED]
An absolute point of time, as formed by the combination of a date a daytime in
GMT
e.g. [EMAIL PROTECTED]:59:59:000. GMT is the universal time at the Greenwich
meridian,
without any daylight savings time (DST). As such GMT times are 'absolute'
(continuous,
without hour jumps as in DST), so accurate time difference computations can be
performed.
-{\small
-\begin{verbatim}
+
[EMAIL PROTECTED]
print format: DATE ' ' DAYTIME
parse format: DATE ' ' DAYTIME ['GMT' ZONE ]
with: DATE = a valid parse format of the date atom (as decribed earlier)
DAYTIME = a valid parse format of the daytime atom (as decribed earlier)
ZONE = ('+'|'-') HOUR ':' MIN [ 'DST' ]
-\end{verbatim}
-}
[EMAIL PROTECTED] verbatim
+
Though internally timestamps are stored in GMT, the printing and parsing of
timestamps is relative to the local timezone. That is, timestamps are
printed without GMT part, meaning that the time is relative to the local
@@ -319,7 +327,6 @@
@:compareGrp(timestamp)@
[EMAIL PROTECTED]
When creating a timestamp from a date and daytime, a timezone should be
specified
(if timezone is omitted, the local timezone is assumed). If a timezone is
specified,
it is used to convert the date and time in that timezone to GMT, which is the
internal
@@ -330,37 +337,37 @@
occurrence (still within DST).
@+ tzone
[EMAIL PROTECTED]
-A timezone determines a {\em time offset} from GMT with format
+A timezone determines a @emph{time offset} from GMT with format
[-] HOUR ':' MINUTES, with HOUR between [0:23] and MINUTES between [0:59].
-Possibly, {\em Daylight Savings Time} (DST) is in force in a timezone, which
means that
-between a start and an end date, the clock is set back {\bf one hour}. The
start and
-end date of DST are determined by a {\em rule}. These rules (similar to the
-Java Timezone class) are made up of 4 parameters: a month {\bf M}, a day
number in the
-month {\bf D}, a day-of-week (monday,..,sunday) denoted {\bf W}, and a daytime
{\bf T}
+Possibly, @emph{Daylight Savings Time} (DST) is in force in a timezone, which
means that
+between a start and an end date, the clock is set back @b{one hour}. The start
and
+end date of DST are determined by a @emph{rule}. These rules (similar to the
+Java Timezone class) are made up of 4 parameters: a month @b{M}, a day number
in the
+month @b{D}, a day-of-week (monday,..,sunday) denoted @b{W}, and a daytime
@b{T}
(only to the minute detail).
Depending of the values of these parameters, five kinds of rules can be made
(similar to the Java TimeZone class):
-\begin{itemize}
-\item first {\bf D}th weekday {\bf W} from start of month {\bf M}.\\
-iff {\bf D} in [1,..,5], {\bf W} in [1,..,7]
-\item last {\bf D}th weekday {\bf W} from end of month {\bf M}.\\
-iff {\bf D} in [-5,..,-1], {\bf W} in [1,..,7]
[EMAIL PROTECTED] @bullet
[EMAIL PROTECTED] first @b{D}th weekday @b{W} from start of month @b{M}.
+iff @b{D} in [1,..,5], @b{W} in [1,..,7]
-\item first weekday {\bf W} in month {\bf M} after exact {\bf D}th day of
month.\\
-iff {\bf D} in [1,..,31], {\bf W} in [-7,..,-1]
[EMAIL PROTECTED] last @b{D}th weekday @b{W} from end of month @b{M}.
+iff @b{D} in [-5,..,-1], @b{W} in [1,..,7]
-\item last weekday {\bf W} in month {\bf M} before exact {\bf D}th day of
month.\\
-iff {\bf D} in [-31,..,-1], {\bf W} in [-7,..,-1]
[EMAIL PROTECTED] first weekday @b{W} in month @b{M} after exact @b{D}th day of
month.
+iff @b{D} in [1,..,31], @b{W} in [-7,..,-1]
-\item exact {\bf D}th day of month {\bf M}.\\
-iff {\bf D} in [1,..,31], {\bf W}=0;
[EMAIL PROTECTED] last weekday @b{W} in month @b{M} before exact @b{D}th day of
month.
+iff @b{D} in [-31,..,-1], @b{W} in [-7,..,-1]
-\end{itemize}
-The parameters {\bf M} is a month number between 1 and 12, and {\bf T} is a
time
[EMAIL PROTECTED] exact @b{D}th day of month @b{M}.
+iff @b{D} in [1,..,31], @b{W}=0;
[EMAIL PROTECTED] itemize
+
+The parameters @b{M} is a month number between 1 and 12, and @b{T} is a time
to the minute detail just like the time offset of the timezone.
Other values of the rule parameters on creating a timezone will produce a
@@ -517,7 +524,6 @@
from GMT and a DST.";
@+ Time/date decomposition
[EMAIL PROTECTED]
There are routines that decompose a date and routines that decompose a daytime.
For decomposing a timestamp, there are routines that decompose it in a date
and daytime. The bulk variants are also provided to simplify code
@@ -616,7 +622,6 @@
comment "extract minutes from rule.";
@+ Time/date arithmetic
[EMAIL PROTECTED]
We choose to represent intervals of time as numbers of days (as int, a 32-bits
integer)
and numbers of milliseconds (as lng, a 64-bits integer). Using standard
integer types
facilitates computation with these amounts of time (you can use all normal
integer
@@ -3913,7 +3918,6 @@
@:Extract(daytime,minutes,int)@
@:Extract(daytime,seconds,int)@
@:Extract(daytime,milliseconds,int)@
[EMAIL PROTECTED]
str
MTIMEstrptime(date *d, str *s, str *format)
@@ -3950,3 +3954,4 @@
#endif
throw(MAL, "mtime.str_to_date", "strptime support missing");
}
[EMAIL PROTECTED]
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins