Update of /cvsroot/aimmath/AIM/WEB-INF/maple
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11288
Modified Files:
AutoConf.mpl AutoConfWin.mpl Date.mpl ManualConfig.dist
Log Message:
Fixes problems with Summer Time. In particular, introduces a variable
`Date/SummerTimeSpec` with which one can set the Summer Time specification
for one's locale without being defaulted to a possibly erroneous setting
for the Northern Hemisphere. New functions added in Date.mpl:
`Date/DaysSince1Jan2000`, `Date/DayOfNthSundayOfMonth`, `Date/Test`
Also, `Date/SummerTime` is now a function (rather than a table), that
returns a list consisting of two month, day pairs which are the beginning
and end dates of Summer Time for the locale, determined from
`Date/SummerTimeSpec`.
Finally, `Date/IsSummer` now takes account of whether there is no Summer
Time, or whether the locale is in the Northern or Southern Hemisphere. - GG
Index: AutoConf.mpl
===================================================================
RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/AutoConf.mpl,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** AutoConf.mpl 16 Jan 2004 22:57:15 -0000 1.8
--- AutoConf.mpl 11 Apr 2004 07:08:12 -0000 1.9
***************
*** 26,29 ****
--- 26,30 ----
unassign('`Date/LocalTimeZoneName`'):
unassign('`Date/LocalTimeZoneOffset`'):
+ unassign('`Date/SummerTimeSpec`'):
traperror(fclose("autoconf.log")):
***************
*** 711,718 ****
--- 712,731 ----
fi:
+ if type([`Date/SummerTimeSpec`], [listlist]) then
+ summertimespec := `Date/SummerTimeSpec`:
+ q("The Summer Time specification is set to %A\n", summertimespec):
+ else
+ summertimespec := [ [4, 1], [10, 5] ]:
+ q("The Summer Time specification is set to the default for the Northern\n"):
+ q("hemisphere (1st Sunday in April to the last Sunday in October),\n"):
+ q("i.e. it is set to %A\n", summertimespec):
+ fi:
+
`Date/LocalTimeZoneName` := timezone:
`Date/LocalTimeZoneOffset` := timeoffset:
+ `Date/SummerTimeSpec` := summertimespec:
p("Time zone set to %s (= UTC +%A hours)\n",timezone,timeoffset/3600):
+ p("Summer Time specification set to %A\n", summertimespec):
######################################################################
***************
*** 832,839 ****
setconfig('AliceHistorySize',20):
setconfig('MaxMapleProcesses',8):
! setconfig('StudentTimeLimit',60000): # one minute
setconfig('AdminTimeLimit',1200000): # twenty minutes
! setconfig('TimeLimit',2.0): # two seconds
# END KM
--- 845,852 ----
setconfig('AliceHistorySize',20):
setconfig('MaxMapleProcesses',8):
! setconfig('StudentTimeLimit',120000): # two minutes
setconfig('AdminTimeLimit',1200000): # twenty minutes
! setconfig('TimeLimit',4.0): # four seconds
# END KM
***************
*** 901,904 ****
--- 914,918 ----
m("`Date/LocalTimeZoneName` := %a:\n",`Date/LocalTimeZoneName`):
m("`Date/LocalTimeZoneOffset` := %d:\n",`Date/LocalTimeZoneOffset`):
+ m("`Date/SummerTimeSpec` := %A:\n",`Date/SummerTimeSpec`):
m("\n\n"):
Index: AutoConfWin.mpl
===================================================================
RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/AutoConfWin.mpl,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** AutoConfWin.mpl 16 Jan 2004 22:57:15 -0000 1.4
--- AutoConfWin.mpl 11 Apr 2004 07:08:13 -0000 1.5
***************
*** 22,25 ****
--- 22,26 ----
unassign('`Date/LocalTimeZoneName`'):
unassign('`Date/LocalTimeZoneOffset`'):
+ unassign('`Date/SummerTimeSpec`'):
p := proc() printf(args); end:
***************
*** 608,613 ****
--- 609,625 ----
fi:
+ if type([`Date/SummerTimeSpec`], [listlist]) then
+ summertimespec := `Date/SummerTimeSpec`:
+ q("The Summer Time specification is set to %A\n", summertimespec):
+ else
+ summertimespec := [ [4, 1], [10, 5] ]:
+ q("The Summer Time specification is set to the default for the Northern\n"):
+ q("hemisphere (1st Sunday in April to the last Sunday in October),\n"):
+ q("i.e. it is set to %A\n", summertimespec):
+ fi:
+
`Date/LocalTimeZoneName` := timezone:
`Date/LocalTimeZoneOffset` := timeoffset:
+ `Date/SummerTimeSpec` := summertimespec:
p("Time zone set to %s (= UTC +%A hours)\n",timezone,timeoffset/3600):
***************
*** 828,831 ****
--- 840,844 ----
m("`Date/LocalTimeZoneName` := %a:\n",`Date/LocalTimeZoneName`):
m("`Date/LocalTimeZoneOffset` := %d:\n",`Date/LocalTimeZoneOffset`):
+ m("`Date/SummerTimeSpec` := %A:\n",`Date/SummerTimeSpec`):
m("\n\n"):
Index: ManualConfig.dist
===================================================================
RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/ManualConfig.dist,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ManualConfig.dist 25 Sep 2003 19:01:15 -0000 1.3
--- ManualConfig.dist 11 Apr 2004 07:08:13 -0000 1.4
***************
*** 122,132 ****
# table.
#
- # The handling of summer time may not be correct in Europe, and is
- # certainly incorrect in the southern hemisphere. It is recommended
- # that you adjust manually for this.
- #
# `Date/LocalTimeZoneName` := "GMT":
# `Date/LocalTimeZoneOffset` := 0:
######################################################################
--- 122,145 ----
# table.
#
# `Date/LocalTimeZoneName` := "GMT":
# `Date/LocalTimeZoneOffset` := 0:
+ ######################################################################
+ # The handling of summer time may not be correct in Europe, and is
+ # certainly incorrect in the southern hemisphere. It is recommended
+ # that you adjust manually for this here. The default value of the
+ # Summer Time specification is [ [1, 4], [5, 10] ] which means from
+ # the 1st Sunday of the 4th month (April) to the 5th (or last) Sunday
+ # in the 10th month (October). [ [0, 0], [0, 0] ] is special and means
+ # `no Summer Time'. If required, uncomment the first non-blank line below
+ # and the line that corresponds to your situation (total of two lines),
+ # or provide your own.
+ #
+ #`Date/SummerTimeSpec` :=
+ # [ [4, 1], [10, 5] ]: # Europe (usually) + USA (default)
+ # [ [3, 5], [10, 5] ]: # Europe (2003): Last Sun in Mar -> Last Sun in Oct
+ # [ [10, 5], [3, 5] ]: # Last Sun, Oct -> Last Sun, Mar (Aust: SA, Vic, NSW)
+ # [ [10, 1], [3, 5] ]: # 1st Sun, Oct -> Last Sun, Mar (Aust: Tasmania)
+ # [ [0, 0], [0, 0] ]: # No Summer Time (Aust: WA, Qld, NT)
######################################################################
Index: Date.mpl
===================================================================
RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/Date.mpl,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Date.mpl 11 Mar 2004 13:39:42 -0000 1.5
--- Date.mpl 11 Apr 2004 07:08:13 -0000 1.6
***************
*** 88,91 ****
--- 88,92 ----
"WAT" =-01,
"WET" = 0,
+ "WST" =+08,
"YDT" =-08,
"YST" =-09
***************
*** 210,219 ****
`Package/Assign`(
`Date/IsLeapYear`::boolean,
! "Returns @true@ if @year@ is a leap year, and false otherwise.
! Years divisible by 100 are usally not leap years, but the year
! 2000 is an exception, and we are unlikely to need any other
! centuries. We therefore use the naive rule.",
proc(year::integer)
! RETURN(evalb(irem(year,4) = 0));
end
):
--- 211,218 ----
`Package/Assign`(
`Date/IsLeapYear`::boolean,
! "Returns @true@ if @year@ is a leap year, and false otherwise.",
proc(year::integer)
! RETURN(evalb(irem(year, 400) = 0 or
! irem(year, 100) <> 0 and irem(year, 4) = 0));
end
):
***************
*** 278,316 ****
`Package/Assign`(
! `Date/SummerTime`::table,
! "A table indexed by the years from 1970..2100, whose entries
! are lists of two integers. The first integer is the
! first Sunday in April, the second is the last Sunday in October.
",
! ### TODO: work out the algorithm
! table([
! 1970=[5, 25],1971=[4, 31],1972=[2, 29],1973=[1, 28],1974=[7, 27],
! 1975=[6, 26],1976=[4, 31],1977=[3, 30],1978=[2, 29],1979=[1, 28],
! 1980=[6, 26],1981=[5, 25],1982=[4, 31],1983=[3, 30],1984=[1, 28],
! 1985=[7, 27],1986=[6, 26],1987=[5, 25],1988=[3, 30],1989=[2, 29],
! 1990=[1, 28],1991=[7, 27],1992=[5, 25],1993=[4, 31],1994=[3, 30],
! 1995=[2, 29],1996=[7, 27],1997=[6, 26],1998=[5, 25],1999=[4, 31],
! 2000=[2, 29],2001=[1, 28],2002=[7, 27],2003=[6, 26],2004=[4, 26],
! 2005=[3, 30],2006=[2, 29],2007=[1, 28],2008=[6, 26],2009=[5, 25],
! 2010=[4, 31],2011=[3, 30],2012=[1, 28],2013=[7, 27],2014=[6, 26],
! 2015=[5, 25],2016=[3, 30],2017=[2, 29],2018=[1, 28],2019=[7, 27],
! 2020=[5, 25],2021=[4, 31],2022=[3, 30],2023=[2, 29],2024=[7, 27],
! 2025=[6, 26],2026=[5, 25],2027=[4, 31],2028=[2, 29],2029=[1, 28],
! 2030=[7, 27],2031=[6, 26],2032=[4, 31],2033=[3, 30],2034=[2, 29],
! 2035=[1, 28],2036=[6, 26],2037=[5, 25],2038=[4, 31],2039=[3, 30],
! 2040=[1, 28],2041=[7, 27],2042=[6, 26],2043=[5, 25],2044=[3, 30],
! 2045=[2, 29],2046=[1, 28],2047=[7, 27],2048=[5, 25],2049=[4, 31],
! 2050=[3, 30],2051=[2, 29],2052=[7, 27],2053=[6, 26],2054=[5, 25],
! 2055=[4, 31],2056=[2, 29],2057=[1, 28],2058=[7, 27],2059=[6, 26],
! 2060=[4, 31],2061=[3, 30],2062=[2, 29],2063=[1, 28],2064=[6, 26],
! 2065=[5, 25],2066=[4, 31],2067=[3, 30],2068=[1, 28],2069=[7, 27],
! 2070=[6, 26],2071=[5, 25],2072=[3, 30],2073=[2, 29],2074=[1, 28],
! 2075=[7, 27],2076=[5, 25],2077=[4, 31],2078=[3, 30],2079=[2, 29],
! 2080=[7, 27],2081=[6, 26],2082=[5, 25],2083=[4, 31],2084=[2, 29],
! 2085=[1, 28],2086=[7, 27],2087=[6, 26],2088=[4, 31],2089=[3, 30],
! 2090=[2, 29],2091=[1, 28],2092=[6, 26],2093=[5, 25],2094=[4, 31],
! 2095=[3, 30],2096=[1, 28],2097=[7, 27],2098=[6, 26],2099=[5, 25],
! 2100=[4, 31]
! ])):
`Package/Assign`(
--- 277,348 ----
`Package/Assign`(
! `Date/DaysSince1Jan2000`::integer,
! "Returns for the specified @year@, @month@ and @day@, the number of days
! since the 1st of January, 2000.
",
! proc(year::posint, month::posint, day::posint)
! local i;
! if year < 2000 then
! error sprintf(__("Year out of range (must be >= 2000): %A"), year);
! elif month > 12 then
! error sprintf(__("Month invalid: %A"), month);
! elif day > `Date/MonthLength`(month, year) then
! error sprintf(__("Day invalid (must be <= %A): %A"),
! `Date/MonthLength`(month, year), day);
! fi;
! (year - 2000) * 365
! + `Date/LeapYearCount`(2000, year)
! + `if`(evalb(`Date/IsLeapYear`(year) and month > 2), 1, 0)
! + sum(`Date/MonthLengths`[i], i = 1 .. month - 1)
! + day - 1;
! end
! ):
!
! `Package/Assign`(
! `Date/DayOfNthSundayOfMonth`::integer,
! "Returns list [@m@, @d@] where @d@ is the numeric day of the @n@th Sunday
! of the @m@th month of @year@, except that if that day is larger than the
! number of days in the month then the day of the last Sunday of the month
! is returned. (So choosing @n@ = 5 will give the day of the last Sunday of
! the month.)
! ",
! proc(year::posint, m::posint, n::posint)
! local d;
! # 1st of January, 2000 was a Saturday
! d := 1 + ((1 - `Date/DaysSince1Jan2000`(year, m, 1)) mod 7) + 7 * (n - 1);
! while d > `Date/MonthLength`(m, year) do
! d := d - 7;
! od;
! return [m, d];
! end
! ):
!
! `Package/Assign`(
! `Date/Test`::boolean,
! "If @oper@ is @`>`@ (resp. @`>=`@) returns @true@ if @lis1@ specifies
! a day of a month that is later (resp. not earlier) in the year than
! the day of the month specified by @lis2@. Each of @lis1@ and @lis2@
! should be a list of form [@month@, @day@].
! ",
! proc(lis1::[posint, posint], lis2::[posint, posint], oper::symbol)
! evalb(oper(31 * (lis1[1] - lis2[1]) + lis1[2] - lis2[2], 0));
! end
! ):
!
! `Package/Assign`(
! `Date/SummerTime`::list,
! "Returns a list [ [@m1@, @d1@], [@m2@, @d2@] ] where @m1@ and @d1@
! specify the month and day Summer Time begins and @m2@ and @d2@
! specify the month and day Summer Time ends for the year @year@.
! @[ [0, 0], [0, 0] ]@ specifies no Summer Time.
! ",
! proc(year::posint)
! if `Date/SummerTimeSpec`[1][1] = 0 then
! return `Date/SummerTimeSpec`; # No Summer Time case
! fi;
! map( curry(`Date/DayOfNthSundayOfMonth`, year) @ op,
! `Date/SummerTimeSpec` );
! end
! ):
`Package/Assign`(
***************
*** 320,333 ****
",
proc(year,month,day)
! local msg;
! if (year < 1970 or year > 2100) then
! msg := sprintf(__("Year out of range: %A"),year);
! ERROR(msg);
! fi;
!
! evalb((month > 4 and month < 10) or
! (month = 4 and day >= `Date/SummerTime`[year][1]) or
! (month = 10 and day < `Date/SummerTime`[year][2]));
end
):
--- 352,369 ----
",
proc(year,month,day)
! local summerbegin, summerend;
! summerbegin, summerend := op(`Date/SummerTime`(year));
!
! evalb( # If no Summer Time just return false
! summerbegin[1] > 0 and
! `if`(`Date/Test`(summerend, summerbegin, `>`),
! # Northern Hemisphere case
! `Date/Test`([month, day], summerbegin, `>=`) and
! `Date/Test`([month, day], summerend, `<`),
! # Southern Hemisphere case
! `Date/Test`([month, day], summerend, `<`) or
! `Date/Test`([month, day], summerbegin, `>=`)
! ) );
end
):
***************
*** 342,346 ****
if (SearchText("APPLE",interface('version')) > 0) then
! `Date/CurentRawDate` :=
proc() 2212118897 + iolib(25); end:
fi:
--- 378,382 ----
if (SearchText("APPLE",interface('version')) > 0) then
! `Date/CurrentRawDate` :=
proc() 2212118897 + iolib(25); end:
fi:
|