Update of /cvsroot/monetdb/MonetDB5/src/modules/atoms
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv15857/src/modules/atoms
Modified Files:
blob.mx inet.mx mtime.mx str.mx
Log Message:
propagated changes of Sunday Feb 03 2008 - Friday Feb 08 2008
from the MonetDB_5-4 branch to the development trunk
Index: inet.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/modules/atoms/inet.mx,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- inet.mx 11 Jan 2008 10:41:35 -0000 1.26
+++ inet.mx 8 Feb 2008 22:36:31 -0000 1.27
@@ -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
@@ -87,17 +88,19 @@
inet_export str INET_fromstr(inet *ret, str *s);
@c
[EMAIL PROTECTED]
#include "mal_config.h"
#include <gdk.h>
#include "mal.h"
#include "mal_exception.h"
#include "inet.h"
-
[EMAIL PROTECTED]
@mal
command fromstr()
address INETfromString
comment "Convert a string to an inet";
@c
[EMAIL PROTECTED]
/**
* Creates a new inet from the given string.
* Warning: GDK function, does NOT pass a string by reference, and wants
@@ -223,12 +226,13 @@
*len = 0; /* signal INETnew something went wrong */
return(i - 1);
}
-
[EMAIL PROTECTED]
@mal
command tostr()
address INETtoString
comment "Convert inet to string equivalent";
@c
[EMAIL PROTECTED]
/**
* Returns the string representation of the given inet value.
* Warning: GDK function
@@ -254,12 +258,13 @@
return(*len);
}
-
[EMAIL PROTECTED]
@mal
command new(s:str):inet
address INETnew
comment "Create an inet from a string literal";
@c
[EMAIL PROTECTED]
/**
* Returns a inet, parsed from a string. The fromStr function is used
* to parse the string.
@@ -279,12 +284,13 @@
/* === Operators === */
-
[EMAIL PROTECTED]
@mal
command isnil(v:inet):bit
address INET_isnil
comment "Nil test for inet value";
@c
[EMAIL PROTECTED]
/**
* Returns whether val represents a nil inet value
*/
@@ -295,12 +301,13 @@
return (MAL_SUCCEED);
}
-
[EMAIL PROTECTED]
@mal
command =(v:inet,w:inet):bit
address INET_comp_EQ
comment "Equality of two inets";
@c
[EMAIL PROTECTED]
/**
* Returns whether val1 and val2 are equal.
*/
@@ -317,12 +324,13 @@
return (MAL_SUCCEED);
}
-
[EMAIL PROTECTED]
@mal
command !=(v:inet,w:inet):bit
address INET_comp_NEQ
comment "Inequality of two inets";
@c
[EMAIL PROTECTED]
/**
* Returns whether val1 and val2 are not equal.
*/
@@ -339,12 +347,13 @@
return (MAL_SUCCEED);
}
-
[EMAIL PROTECTED]
@mal
command <(v:inet,w:inet):bit
address INET_comp_LT
comment "Whether v is less than w";
@c
[EMAIL PROTECTED]
/**
* Returns whether val1 is smaller than val2.
*/
@@ -377,12 +386,13 @@
return (MAL_SUCCEED);
}
-
[EMAIL PROTECTED]
@mal
command >(v:inet,w:inet):bit
address INET_comp_GT
comment "Whether v is greater than w";
@c
[EMAIL PROTECTED]
/**
* Returns whether val1 is greater than val2.
*/
@@ -391,12 +401,13 @@
{
return (INET_comp_LT(retval, val2, val1));
}
-
[EMAIL PROTECTED]
@mal
command <=(v:inet,w:inet):bit
address INET_comp_LE
comment "Whether v is less than or equal to w";
@c
[EMAIL PROTECTED]
/**
* Returns whether val1 is smaller than or equal to val2.
*/
@@ -412,12 +423,13 @@
*retval = ret;
return (MAL_SUCCEED);
}
-
[EMAIL PROTECTED]
@mal
command >=(v:inet,w:inet):bit
address INET_comp_GE
comment "Whether v is equal to or greater than w";
@c
[EMAIL PROTECTED]
/**
* Returns whether val1 is smaller than or equal to val2.
*/
@@ -435,12 +447,13 @@
*retval = ret;
return (MAL_SUCCEED);
}
-
[EMAIL PROTECTED]
@mal
command <<(v:inet,w:inet):bit
address INET_comp_CW
comment "Whether v is contained within w";
@c
[EMAIL PROTECTED]
/**
* Returns whether val1 is contained within val2
*/
@@ -503,12 +516,13 @@
}
return (MAL_SUCCEED);
}
-
[EMAIL PROTECTED]
@mal
command <<=(v:inet,w:inet):bit
address INET_comp_CWE
comment "Whether v is contained within or is equal to w";
@c
[EMAIL PROTECTED]
/**
* Returns whether val1 is contained within or equal to val2
*/
@@ -525,12 +539,13 @@
*retval = ret;
return (MAL_SUCCEED);
}
-
[EMAIL PROTECTED]
@mal
command >>(v:inet,w:inet):bit
address INET_comp_CS
comment "Whether v contains w";
@c
[EMAIL PROTECTED]
/**
* Returns whether val1 is contains val2
*/
@@ -540,12 +555,13 @@
/* swap the input arguments and call the contained within function */
return (INET_comp_CW(retval, val2, val1));
}
-
[EMAIL PROTECTED]
@mal
command >>=(v:inet,w:inet):bit
address INET_comp_CSE
comment "Whether v contains or is equal to w";
@c
[EMAIL PROTECTED]
/**
* Returns whether val1 contains or is equal to val2
*/
@@ -558,12 +574,13 @@
/* === Functions === */
-
[EMAIL PROTECTED]
@mal
command broadcast(:inet):inet
address INETbroadcast
comment "Returns the broadcast address for network";
@c
[EMAIL PROTECTED]
/**
* Returns the broadcast address for the network the inet represents.
* If the subnet mask is 32, the given input inet is returned.
@@ -617,12 +634,13 @@
}
return (MAL_SUCCEED);
}
-
[EMAIL PROTECTED]
@mal
command host(:inet):str
address INEThost
comment "Extract IP address as text";
@c
[EMAIL PROTECTED]
/**
* Extract only the IP address as text. Unlike the toString function,
* this function never returns the netmask length.
@@ -643,12 +661,13 @@
}
return (MAL_SUCCEED);
}
-
[EMAIL PROTECTED]
@mal
command masklen(:inet):int
address INETmasklen
comment "Extract netmask length";
@c
[EMAIL PROTECTED]
/**
* Extract netmask length.
*/
@@ -662,12 +681,13 @@
}
return (MAL_SUCCEED);
}
-
[EMAIL PROTECTED]
@mal
command setmasklen(:inet,:int):inet
address INETsetmasklen
comment "Set netmask length for inet value";
@c
[EMAIL PROTECTED]
/**
* Set netmask length for inet value.
*/
@@ -683,12 +703,13 @@
return (MAL_SUCCEED);
}
-
[EMAIL PROTECTED]
@mal
command netmask(:inet):inet
address INETnetmask
comment "Construct netmask for network";
@c
[EMAIL PROTECTED]
/**
* Construct netmask for network.
*/
@@ -733,12 +754,13 @@
}
return (MAL_SUCCEED);
}
-
[EMAIL PROTECTED]
@mal
command hostmask(:inet):inet
address INEThostmask
comment "Construct host mask for network";
@c
[EMAIL PROTECTED]
/**
* Construct host mask for network.
*/
@@ -763,12 +785,13 @@
return (MAL_SUCCEED);
}
-
[EMAIL PROTECTED]
@mal
command network(:inet):inet
address INETnetwork
comment "Extract network part of address";
@c
[EMAIL PROTECTED]
/**
* Extract network part of address, returns the same inet if the netmask
* is equal to 32. This function basically zeros out values that are
@@ -816,12 +839,13 @@
}
return (MAL_SUCCEED);
}
-
[EMAIL PROTECTED]
@mal
command text(:inet):str
address INETtext
comment "Extract IP address and netmask length as text";
@c
[EMAIL PROTECTED]
/**
* Extract IP address and netmask length as text. Unlike the toStr
* function, this function always prints the netmask length.
@@ -842,12 +866,13 @@
}
return (MAL_SUCCEED);
}
-
[EMAIL PROTECTED]
@mal
command abbrev(:inet):str
address INETabbrev
comment "Abbreviated display format as text";
@c
[EMAIL PROTECTED]
/**
* Abbreviated display format as text. The abbreviation is only made if
* the value has no bits set to right of mask. Otherwise the return of
@@ -913,9 +938,7 @@
}
return (MAL_SUCCEED);
}
-
@}
-
@mal
module calc;
@@ -923,6 +946,7 @@
address INET_inet
comment "Convert a inet to an inet";
[EMAIL PROTECTED]
@c
str
INET_inet(inet *d, inet *s)
@@ -930,12 +954,12 @@
*d = *s;
return MAL_SUCCEED;
}
-
[EMAIL PROTECTED]
@mal
command inet(s:str):inet
address INET_fromstr
comment "Convert a string to an inet";
-
[EMAIL PROTECTED]
@c
str
INET_fromstr(inet *ret, str *s)
@@ -944,7 +968,7 @@
INETfromString(*s, &len, &ret);
return MAL_SUCCEED;
}
-
[EMAIL PROTECTED]
@mal
command isnil(v:inet):bit
address INET_isnil
Index: blob.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/modules/atoms/blob.mx,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- blob.mx 11 Jan 2008 10:41:34 -0000 1.39
+++ blob.mx 8 Feb 2008 22:36:31 -0000 1.40
@@ -758,6 +758,7 @@
section of the blob modules from MonetDB 4.3
@-
@c
[EMAIL PROTECTED]
int
BLOBnequal(blob *l, blob *r)
{
Index: str.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/modules/atoms/str.mx,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -d -r1.73 -r1.74
--- str.mx 11 Jan 2008 10:41:35 -0000 1.73
+++ str.mx 8 Feb 2008 22:36:31 -0000 1.74
@@ -18,7 +18,6 @@
@a N.J. Nes, M.L. Kersten
@v 1.1
@+ The String Module
[EMAIL PROTECTED]
Strings can be created in many ways. Already in the built-in operations
each atom can be cast to a string using the str(atom) mil command.
The string module gives the possibility of construction string as a
@@ -326,7 +325,6 @@
#endif
@+ UTF-8 Handling
[EMAIL PROTECTED]
UTF-8 is a way to store Unicode strings in zero-terminated byte sequences,
which you can e.g.
strcmp() with old 8-bit Latin-1 strcmp() functions and which then gives the
same results as doing
the strcmp() on equivalent Latin-1 and ASCII character strings stored in
simple one-byte sequences.
Index: mtime.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/modules/atoms/mtime.mx,v
retrieving revision 1.106
retrieving revision 1.107
diff -u -d -r1.106 -r1.107
--- mtime.mx 27 Jan 2008 09:48:22 -0000 1.106
+++ mtime.mx 8 Feb 2008 22:36:31 -0000 1.107
@@ -15,11 +15,11 @@
@' All Rights Reserved.
@f mtime
[EMAIL PROTECTED] New Temporal Module
@a Peter Boncz, Martin van Dinther
@v 1.0
[EMAIL PROTECTED] Temporal Module
[EMAIL PROTECTED]
[EMAIL PROTECTED] Temporal Module
The goal of this module is to provide adequate functionality for storing
and manipulated time-related data. The minimum requirement is that data
can easily be imported from all common commercial RDBMS products.
@@ -30,67 +30,77 @@
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
+
[EMAIL PROTECTED] timestamp
+a combination of date and time, indicating an exact point in
-\item[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}
[EMAIL PROTECTED] difference in days
+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).
[EMAIL PROTECTED] difference in msecs
+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
@@ -99,7 +109,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).
@@ -112,8 +122,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
@@ -135,24 +145,25 @@
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
-this we should make timezone\_local a function with a year parameter. The tool
should
+this we should make timezone_local a function with a year parameter. The tool
should
maintain and access the timezone database stored in two bats
[str,timezone],[str,year].
-Lookup of the correct timezone would be dynamic in this structure. The
timezone\_setlocal
+Lookup of the correct timezone would be dynamic in this structure. The
timezone_setlocal
would just set the string name of the timezone.
@+ Time/date comparison
[EMAIL PROTECTED]
@= compareGrp
command ==(v:@1,w:@1):bit
address [EMAIL PROTECTED]
@@ -204,17 +215,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
@@ -229,8 +240,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.
@@ -251,10 +262,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
@@ -265,8 +275,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
@@ -277,21 +287,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,
+e.g. 1999-01-31@@23: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
@@ -299,8 +308,8 @@
an explicit GMT specifier, it is taken to be a timestamp in the local
timezone. The default local timezone is just GMT+00, but it can be set
arbitrarily.
-# not stored as a lng !
@mal
[EMAIL PROTECTED]
atom timestamp :lng;
command fromstr():timestamp
address timestamp_fromstr;
@@ -320,7 +329,7 @@
@: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
@@ -331,37 +340,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
@@ -518,7 +527,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
@@ -617,7 +625,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
@@ -773,7 +780,6 @@
address MTIMEmsec
comment "get time of day in msec since 1-1-1970.";
[EMAIL PROTECTED]
@+ Prelude section
Upon intialization of the time module, we have to
initialize some variables, e.g. nils and the box with predefined
@@ -3914,7 +3920,6 @@
@:Extract(daytime,minutes,int)@
@:Extract(daytime,seconds,int)@
@:Extract(daytime,milliseconds,int)@
[EMAIL PROTECTED]
str
MTIMEstrptime(date *d, str *s, str *format)
@@ -3951,3 +3956,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