Interesting. The DST shift seems to do bad things to the Calendar module, or vice versa. Below, I am skeptical to (5), and find (7) onwards a bit odd, though perhaps correct as designed?
Pike v7.4 release 13 running Hilfe v3.5 (Incremental Pike Frontend)
Calendar.parse("%Y-%M-%D %h:%m:%s %z","2003-03-30 01:00:00 Europe/Stockholm");
(1) Result: Second(Sun 30 Mar 2003 1:00:00 CET)
Calendar.parse("%Y-%M-%D %h:%m:%s %z","2003-03-30 02:00:00 Europe/Stockholm");
(2) Result: 0
Calendar.parse("%Y-%M-%D %h:%m:%s %z","2003-03-30 03:00:00 Europe/Stockholm");
(3) Result: Second(Sun 30 Mar 2003 3:00:00 CEST)
Calendar.parse("%Y-%M-%D %h:%m:%s %z","2003-03-30 22:00:00 Europe/Stockholm");
(4) Result: Second(Sun 30 Mar 2003 22:00:00 CEST)
Calendar.parse("%Y-%M-%D %h:%m:%s %z","2003-03-30 23:00:00 Europe/Stockholm");
(5) Result: 0
Calendar.Second(2003,3,30,1,0,0);
(6) Result: Second(Sun 30 Mar 2003 1:00:00 CET)
Calendar.Second(2003,3,30,2,0,0);
(7) Result: Second(Sun 30 Mar 2003 3:00:00 CEST)
Calendar.Second(2003,3,30,3,0,0);
(8) Result: Second(Sun 30 Mar 2003 4:00:00 CEST)
Calendar.Second(2003,3,30,22,0,0);
(9) Result: Second(Sun 30 Mar 2003 23:00:00 CEST)
Calendar.Second(2003,3,30,23,0,0);
not in range (second 0..82799 exist) /usr/local/pike/7.4.13/lib/modules/Calendar.pmod/YMD.pmod:871: Day(Sun 30 Mar 2003)->get_unit("second",82800) /usr/local/pike/7.4.13/lib/modules/Calendar.pmod/Time.pmod:128: Second(Sun 30 Mar 2003 0:00:00 CET sharp)->create_backtry(23,0,0) /usr/local/pike/7.4.13/lib/modules/Calendar.pmod/YMD.pmod:2368: Second(Sun 30 Mar 2003 0:00:00 CET sharp)->create_backtry(2003,3,30,23,0,0 ) /usr/local/pike/7.4.13/lib/modules/Calendar.pmod/Time.pmod:109: Second(Sun 30 Mar 2003 0:00:00 CET sharp)->create(2003,3,30,23,0,0) object_program(Calendar.ISO): ISO->cSecond() HilfeInput:1: HilfeInput()->___HilfeWrapper()
/ Johan Sundström (folkskådare)
Previous text:
2003-03-30 12:35: Subject: http://pike.ida.liu.se/development/cvs/pike.xml?between=2003-03-30&and=2...
Jag fick just följande överst på ovanstående sida:
RXML run error: Illegal time "2003-03-30 23:59:59". | <emit source="timerange"> | <define variable="var.navi"> | <cache flush-on-no-cache="yes" nocache="for date nav"> | <nocache> | <cache profile="browser">
/ Henrik Grubbström (Lysator)
Calendar.parse("%Y-%M-%D %h:%m:%s %z","2003-03-30 23:00:00 Europe/Stockholm");
(5) Result: 0
That is bad. It's probably from the fact that the 23'rd hour doesn't exist 03-30 (see below), but it's still bad. I can't believe noone noticed before?
Calendar.Second(2003,3,30,2,0,0);
(7) Result: Second(Sun 30 Mar 2003 3:00:00 CEST)
This might be a design fault; but the second hour *is* called "3:00". The parse() function corrects this to match the data, but the Second/Minute/Hour constructors doesn't seem to.
Should they?
/ Mirar
Previous text:
2003-03-30 13:24: Subject: Calendar failure
Interesting. The DST shift seems to do bad things to the Calendar module, or vice versa. Below, I am skeptical to (5), and find (7) onwards a bit odd, though perhaps correct as designed?
Pike v7.4 release 13 running Hilfe v3.5 (Incremental Pike Frontend)
Calendar.parse("%Y-%M-%D %h:%m:%s %z","2003-03-30 01:00:00 Europe/Stockholm");
(1) Result: Second(Sun 30 Mar 2003 1:00:00 CET)
Calendar.parse("%Y-%M-%D %h:%m:%s %z","2003-03-30 02:00:00 Europe/Stockholm");
(2) Result: 0
Calendar.parse("%Y-%M-%D %h:%m:%s %z","2003-03-30 03:00:00 Europe/Stockholm");
(3) Result: Second(Sun 30 Mar 2003 3:00:00 CEST)
Calendar.parse("%Y-%M-%D %h:%m:%s %z","2003-03-30 22:00:00 Europe/Stockholm");
(4) Result: Second(Sun 30 Mar 2003 22:00:00 CEST)
Calendar.parse("%Y-%M-%D %h:%m:%s %z","2003-03-30 23:00:00 Europe/Stockholm");
(5) Result: 0
Calendar.Second(2003,3,30,1,0,0);
(6) Result: Second(Sun 30 Mar 2003 1:00:00 CET)
Calendar.Second(2003,3,30,2,0,0);
(7) Result: Second(Sun 30 Mar 2003 3:00:00 CEST)
Calendar.Second(2003,3,30,3,0,0);
(8) Result: Second(Sun 30 Mar 2003 4:00:00 CEST)
Calendar.Second(2003,3,30,22,0,0);
(9) Result: Second(Sun 30 Mar 2003 23:00:00 CEST)
Calendar.Second(2003,3,30,23,0,0);
not in range (second 0..82799 exist) /usr/local/pike/7.4.13/lib/modules/Calendar.pmod/YMD.pmod:871: Day(Sun 30 Mar 2003)->get_unit("second",82800) /usr/local/pike/7.4.13/lib/modules/Calendar.pmod/Time.pmod:128: Second(Sun 30 Mar 2003 0:00:00 CET sharp)->create_backtry(23,0,0) /usr/local/pike/7.4.13/lib/modules/Calendar.pmod/YMD.pmod:2368: Second(Sun 30 Mar 2003 0:00:00 CET sharp)->create_backtry(2003,3,30,23,0,0 ) /usr/local/pike/7.4.13/lib/modules/Calendar.pmod/Time.pmod:109: Second(Sun 30 Mar 2003 0:00:00 CET sharp)->create(2003,3,30,23,0,0) object_program(Calendar.ISO): ISO->cSecond() HilfeInput:1: HilfeInput()->___HilfeWrapper()
/ Johan Sundström (folkskådare)
I believe that if you parse "23:00:00", you want the hour that is called "23:00", not the "23'rd hour". Especially if they are different.
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
Previous text:
2003-03-30 14:20: Subject: Calendar failure
Calendar.parse("%Y-%M-%D %h:%m:%s %z","2003-03-30 23:00:00 Europe/Stockholm");
(5) Result: 0
That is bad. It's probably from the fact that the 23'rd hour doesn't exist 03-30 (see below), but it's still bad. I can't believe noone noticed before?
Calendar.Second(2003,3,30,2,0,0);
(7) Result: Second(Sun 30 Mar 2003 3:00:00 CEST)
This might be a design fault; but the second hour *is* called "3:00". The parse() function corrects this to match the data, but the Second/Minute/Hour constructors doesn't seem to.
Should they?
/ Mirar
Absolutely. But when you construct it,
Calendar.Second(2003,3,30,2,0,0);
(7) Result: Second(Sun 30 Mar 2003 3:00:00 CEST)
do you want the second hour or the hour called '2'? Which hour called '2' if there are more then one?
/ Mirar
Previous text:
2003-03-30 14:21: Subject: Calendar failure
I believe that if you parse "23:00:00", you want the hour that is called "23:00", not the "23'rd hour". Especially if they are different.
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
That wasn't how jhs constructed it though.
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
Previous text:
2003-03-30 14:23: Subject: Calendar failure
Absolutely. But when you construct it,
Calendar.Second(2003,3,30,2,0,0);
(7) Result: Second(Sun 30 Mar 2003 3:00:00 CEST)
do you want the second hour or the hour called '2'? Which hour called '2' if there are more then one?
/ Mirar
Well, ok, but I was referring to the first quote. :) I'm not particularly biased in how the raw constructor should work as long as it is documented.
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
Previous text:
2003-03-30 14:27: Subject: Calendar failure
Funny you should say that, since it's a quote from his message. ;-)
/ Mirar
The parser should obviously do it's job and it doesn't. :)
/ Mirar
Previous text:
2003-03-30 14:29: Subject: Calendar failure
Well, ok, but I was referring to the first quote. :) I'm not particularly biased in how the raw constructor should work as long as it is documented.
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
I would commit, but there is something funny going on.
cvs server: conflict: YMD.pmod is modified but no longer in the repository C YMD.pmod
/ Mirar
Previous text:
2003-03-30 14:38: Subject: Calendar failure
What's the timeframe? Will you commit today?
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
Since Nilsson knows much better how the Calendar module is supposed to work, I guess I wont be committing any more fixes there.
Here's a fix for the DST problem anyway.
@@ -2487,8 +2491,17 @@ TimeRange tr; if (catch { tr=origin[whut](h,m,s); - } && h==24 && m==0 && s==0) // special case - return origin->end()->second(); + }) + if (h==24 && m==0 && s==0) // special case + return origin->end()->second(); + else + { + object d=origin->day(); + array(cHour) ha=origin->hours(); + int n=search(ha->hour_no(),h); + if (n!=-1) tr=ha[n]->minute(m)->second(s); + else return 0; // no such hour + }
if (tr->hour_no()!=h || tr->minute_no()!=m) {
/ Mirar
Previous text:
2003-03-30 14:42: Subject: Calendar failure
I would commit, but there is something funny going on.
cvs server: conflict: YMD.pmod is modified but no longer in the repository C YMD.pmod
/ Mirar
Applied in Pike 7.5.
/ Henrik Grubbström (Lysator)
Previous text:
2003-03-30 14:47: Subject: Calendar failure
Since Nilsson knows much better how the Calendar module is supposed to work, I guess I wont be committing any more fixes there.
Here's a fix for the DST problem anyway.
@@ -2487,8 +2491,17 @@ TimeRange tr; if (catch { tr=origin[whut](h,m,s);
- } && h==24 && m==0 && s==0) // special case
return origin->end()->second();
})
if (h==24 && m==0 && s==0) // special case
return origin->end()->second();
else
{
object d=origin->day();
array(cHour) ha=origin->hours();
int n=search(ha->hour_no(),h);
if (n!=-1) tr=ha[n]->minute(m)->second(s);
else return 0; // no such hour
}
if (tr->hour_no()!=h || tr->minute_no()!=m) {
/ Mirar
Hum. For some reason, the Calendar testsuite has the following test:
test_eval_error(Calendar.ISO.set_timezone("Europe/Stockholm") ->dwim_time("2000-03-26 23:01:17"))
That shouldn't really be an eval_error, should it? Why did you add this test?
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
Previous text:
2003-03-30 15:04: Subject: Calendar failure
Now also applied.
/ Johan Sundström (folkskådare)
Shouldn't it rather be "2000-03-26 02:01:17" that is supposed to give an error? ^^
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
Previous text:
2003-03-30 16:59: Subject: Calendar failure
Hum. For some reason, the Calendar testsuite has the following test:
test_eval_error(Calendar.ISO.set_timezone("Europe/Stockholm") ->dwim_time("2000-03-26 23:01:17"))
That shouldn't really be an eval_error, should it? Why did you add this test?
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
The silence is deafening. Well, I'll just assume that this was what Johan intended and update the tests...
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
Previous text:
2003-03-30 17:36: Subject: Calendar failure
Shouldn't it rather be "2000-03-26 02:01:17" that is supposed to give an error? ^^
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
this is about switchung to daylight savings time, right? did you guys switch on the 26th?
we switched today (30th)
greetings, martin.
Note the year. This year it's the 30:th.
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
Previous text:
2003-03-30 18:48: Subject: Re: Calendar failure
this is about switchung to daylight savings time, right? did you guys switch on the 26th?
we switched today (30th)
greetings, martin.
/ Brevbäraren
duh! must have my eyes crossed, 2003-03 and 2000-03 look so similar (only 0s and 3s)
greetings, martin.
Has something been disrupted by his efforts at doing away with the own resolver that Calendar used to employ, besides a magic module or two ending up as classes?
/ Johan Sundström (folkskådare)
Previous text:
2003-03-30 14:47: Subject: Calendar failure
Since Nilsson knows much better how the Calendar module is supposed to work, I guess I wont be committing any more fixes there.
Here's a fix for the DST problem anyway.
@@ -2487,8 +2491,17 @@ TimeRange tr; if (catch { tr=origin[whut](h,m,s);
- } && h==24 && m==0 && s==0) // special case
return origin->end()->second();
})
if (h==24 && m==0 && s==0) // special case
return origin->end()->second();
else
{
object d=origin->day();
array(cHour) ha=origin->hours();
int n=search(ha->hour_no(),h);
if (n!=-1) tr=ha[n]->minute(m)->second(s);
else return 0; // no such hour
}
if (tr->hour_no()!=h || tr->minute_no()!=m) {
/ Mirar
Well, no word of what's going on has reached me, so how would I know?
/ Mirar
Previous text:
2003-03-30 15:00: Subject: Calendar failure
Has something been disrupted by his efforts at doing away with the own resolver that Calendar used to employ, besides a magic module or two ending up as classes?
/ Johan Sundström (folkskådare)
Good point. Some creative abuse of a semi-implemented cvs browser feature could be helpful, for an overview of what has happened in those areas recently:
http://pike.ida.liu.se/development/cvs/pike.xml?v=7.5/lib/modules/Calendar.p...
(This feature is useful enough to end up easily accessable somehow by the way, and hence probably will in a while.)
/ Johan Sundström (folkskådare)
Previous text:
2003-03-30 15:03: Subject: Calendar failure
Well, no word of what's going on has reached me, so how would I know?
/ Mirar
When people start to rename files, change API and reindent my code without giving me any word at all, I usually give up that project.
The CVS browser doesn't help more then cvs log from that aspect.
/ Mirar
Previous text:
2003-03-30 15:25: Subject: Calendar failure
Good point. Some creative abuse of a semi-implemented cvs browser feature could be helpful, for an overview of what has happened in those areas recently:
http://pike.ida.liu.se/development/cvs/pike.xml?v=7.5/lib/modules/Calendar.p...
(This feature is useful enough to end up easily accessable somehow by the way, and hence probably will in a while.)
/ Johan Sundström (folkskådare)
Oh, I did give you word about it, but it was a year or two back.
/ Martin Nilsson (har bott i google)
Previous text:
2003-03-30 15:33: Subject: Calendar failure
When people start to rename files, change API and reindent my code without giving me any word at all, I usually give up that project.
The CVS browser doesn't help more then cvs log from that aspect.
/ Mirar
Points for obviously being right about that design. :-)
/ Johan Sundström (folkskådare)
Previous text:
2003-03-30 14:23: Subject: Calendar failure
Absolutely. But when you construct it,
Calendar.Second(2003,3,30,2,0,0);
(7) Result: Second(Sun 30 Mar 2003 3:00:00 CEST)
do you want the second hour or the hour called '2'? Which hour called '2' if there are more then one?
/ Mirar
Which hour is called '2' if there are more then one?
The first one, it seems, both according to constructor and parser. ;-)
Pike v7.5 release 5 running Hilfe v3.5 (Incremental Pike Frontend)
map(enumerate(5),Calendar.Day(2003,10,26)->hour);
(1) Result: ({ /* 5 elements */ Hour(Sun 26 Oct 2003 0:00 CEST), Hour(Sun 26 Oct 2003 1:00 CEST), Hour(Sun 26 Oct 2003 2:00 CEST), Hour(Sun 26 Oct 2003 2:00 CET), Hour(Sun 26 Oct 2003 3:00 CET) })
Calendar.parse("%Y-%M-%D %h:%m:%s %z","2003-10-26 02:00:00 CEST");
(2) Result: Second(Sun 26 Oct 2003 2:00:00 CEST)
Calendar.parse("%Y-%M-%D %h:%m:%s %z","2003-10-26 02:00:00 CET");
(3) Result: Second(Sun 26 Oct 2003 2:00:00 CEST)
/ Johan Sundström (folkskådare)
Previous text:
2003-03-30 14:23: Subject: Calendar failure
Absolutely. But when you construct it,
Calendar.Second(2003,3,30,2,0,0);
(7) Result: Second(Sun 30 Mar 2003 3:00:00 CEST)
do you want the second hour or the hour called '2'? Which hour called '2' if there are more then one?
/ Mirar
The last result might not be what you would expect though... :/
/ Mirar
Previous text:
2003-03-31 11:29: Subject: Calendar failure
Which hour is called '2' if there are more then one?
The first one, it seems, both according to constructor and parser. ;-)
Pike v7.5 release 5 running Hilfe v3.5 (Incremental Pike Frontend)
map(enumerate(5),Calendar.Day(2003,10,26)->hour);
(1) Result: ({ /* 5 elements */ Hour(Sun 26 Oct 2003 0:00 CEST), Hour(Sun 26 Oct 2003 1:00 CEST), Hour(Sun 26 Oct 2003 2:00 CEST), Hour(Sun 26 Oct 2003 2:00 CET), Hour(Sun 26 Oct 2003 3:00 CET) })
Calendar.parse("%Y-%M-%D %h:%m:%s %z","2003-10-26 02:00:00 CEST");
(2) Result: Second(Sun 26 Oct 2003 2:00:00 CEST)
Calendar.parse("%Y-%M-%D %h:%m:%s %z","2003-10-26 02:00:00 CET");
(3) Result: Second(Sun 26 Oct 2003 2:00:00 CEST)
/ Johan Sundström (folkskådare)
I don't think the constructors are a problem. As for noticing problems in the Calendar module, the cvs browser does a good job; it is closely monitored by humans and exercises big chunks of the module. Problems tend to creep up into visibility that way. :-)
/ Johan Sundström (folkskådare)
Previous text:
2003-03-30 14:20: Subject: Calendar failure
Calendar.parse("%Y-%M-%D %h:%m:%s %z","2003-03-30 23:00:00 Europe/Stockholm");
(5) Result: 0
That is bad. It's probably from the fact that the 23'rd hour doesn't exist 03-30 (see below), but it's still bad. I can't believe noone noticed before?
Calendar.Second(2003,3,30,2,0,0);
(7) Result: Second(Sun 30 Mar 2003 3:00:00 CEST)
This might be a design fault; but the second hour *is* called "3:00". The parse() function corrects this to match the data, but the Second/Minute/Hour constructors doesn't seem to.
Should they?
/ Mirar
pike-devel@lists.lysator.liu.se