Datetime issues

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Datetime issues

Johan Brichau-2
Hi,

I'm having a disagreement with the Date-Time library in Gemstone.

When you evaluate 'Week current', the returned timespan is off by one day, i.e. the week starts a day later than the Week>>startDay that you had set.
For example, if you had set a week's startday to sunday, the week that is returned will start on monday.
If you had set a week's startday to monday, the week that is returned will start on tuesday, etc...

I traced the issue and found out that in Gemstone, the following is not true:

DateAndTime now midnight weekDay = DateAndTime now weekDay

Conversely, in Pharo, this is true and because Week>>current has the same implementation in both Pharo and Gemstone, the result is different in Gemstone.

The easiest fix would be to leave out the use of #midnight in the implementation of Week>>current, but that would mean Gemstone needs a different version for the Chronos package than Pharo.

Or should the issue with #weekDay be fixed?

cheers
Johan
Reply | Threaded
Open this post in threaded view
|

Re: Datetime issues

Dale Henrichs
Johan,

I'll have to look into this ... I did some Date/Time work over the
summer, but I don't think I did much looking at DateAndTime. There are
some fundamental implementation differences that make getting things
working the same a bit difficult ... with that said, I assume that it is
possible to fix...

Dale

On 11/17/2010 01:34 PM, Johan Brichau wrote:

> Hi,
>
> I'm having a disagreement with the Date-Time library in Gemstone.
>
> When you evaluate 'Week current', the returned timespan is off by one day, i.e. the week starts a day later than the Week>>startDay that you had set.
> For example, if you had set a week's startday to sunday, the week that is returned will start on monday.
> If you had set a week's startday to monday, the week that is returned will start on tuesday, etc...
>
> I traced the issue and found out that in Gemstone, the following is not true:
>
> DateAndTime now midnight weekDay = DateAndTime now weekDay
>
> Conversely, in Pharo, this is true and because Week>>current has the same implementation in both Pharo and Gemstone, the result is different in Gemstone.
>
> The easiest fix would be to leave out the use of #midnight in the implementation of Week>>current, but that would mean Gemstone needs a different version for the Chronos package than Pharo.
>
> Or should the issue with #weekDay be fixed?
>
> cheers
> Johan
Reply | Threaded
Open this post in threaded view
|

Re: Datetime issues

Dale Henrichs
In reply to this post by Johan Brichau-2
Johan,

Well, I'm finally taking a look at this (I usually claim that I am nine months behind, so maybe I am finally catching up?).

I'm tracking this with issue 198 (http://code.google.com/p/glassdb/issues/detail?id=198)..and I am not able to reproduce your problem on a couple of fronts ...

the method weekCay doesn't appear to be implemented in DateAndTime (in Pharo or GemStone) and if I replace weekDay with dayOfWeek, I don't have the issue with midnight ...

I assume that there is a bug in here somewhere, so I will look a little deeper...

I guess I'm curious if you are still seeing the problem and if so what version of GLASS you're using (I think the work over last summer did involve monkeying with #midnight) and then some help to reproduce the bug in my environment ...

Dale

On Nov 17, 2010, at 1:34 PM, Johan Brichau wrote:

> Hi,
>
> I'm having a disagreement with the Date-Time library in Gemstone.
>
> When you evaluate 'Week current', the returned timespan is off by one day, i.e. the week starts a day later than the Week>>startDay that you had set.
> For example, if you had set a week's startday to sunday, the week that is returned will start on monday.
> If you had set a week's startday to monday, the week that is returned will start on tuesday, etc...
>
> I traced the issue and found out that in Gemstone, the following is not true:
>
> DateAndTime now midnight weekDay = DateAndTime now weekDay
>
> Conversely, in Pharo, this is true and because Week>>current has the same implementation in both Pharo and Gemstone, the result is different in Gemstone.
>
> The easiest fix would be to leave out the use of #midnight in the implementation of Week>>current, but that would mean Gemstone needs a different version for the Chronos package than Pharo.
>
> Or should the issue with #weekDay be fixed?
>
> cheers
> Johan

Reply | Threaded
Open this post in threaded view
|

Re: Datetime issues

Dale Henrichs
Johan,

While I am unable to reproduce the problem it _is_ worth noting that Issue148 (which I just fixed) does involve an error in the base image, where DateAndTime>>dayOfWeek was not calculated using local time ... I haven't seen a difference in testing in my image, but I would imagine that at the right time of day relative to your offset from GMT that at least the dayOfWeek calculation would be wrong ...

So, for the moment, I am going to assume that Issue 198 is the same as Issue 148 ...

Dale

On Mar 24, 2011, at 9:41 AM, Dale Henrichs wrote:

> Johan,
>
> Well, I'm finally taking a look at this (I usually claim that I am nine months behind, so maybe I am finally catching up?).
>
> I'm tracking this with issue 198 (http://code.google.com/p/glassdb/issues/detail?id=198)..and I am not able to reproduce your problem on a couple of fronts ...
>
> the method weekCay doesn't appear to be implemented in DateAndTime (in Pharo or GemStone) and if I replace weekDay with dayOfWeek, I don't have the issue with midnight ...
>
> I assume that there is a bug in here somewhere, so I will look a little deeper...
>
> I guess I'm curious if you are still seeing the problem and if so what version of GLASS you're using (I think the work over last summer did involve monkeying with #midnight) and then some help to reproduce the bug in my environment ...
>
> Dale
>
> On Nov 17, 2010, at 1:34 PM, Johan Brichau wrote:
>
>> Hi,
>>
>> I'm having a disagreement with the Date-Time library in Gemstone.
>>
>> When you evaluate 'Week current', the returned timespan is off by one day, i.e. the week starts a day later than the Week>>startDay that you had set.
>> For example, if you had set a week's startday to sunday, the week that is returned will start on monday.
>> If you had set a week's startday to monday, the week that is returned will start on tuesday, etc...
>>
>> I traced the issue and found out that in Gemstone, the following is not true:
>>
>> DateAndTime now midnight weekDay = DateAndTime now weekDay
>>
>> Conversely, in Pharo, this is true and because Week>>current has the same implementation in both Pharo and Gemstone, the result is different in Gemstone.
>>
>> The easiest fix would be to leave out the use of #midnight in the implementation of Week>>current, but that would mean Gemstone needs a different version for the Chronos package than Pharo.
>>
>> Or should the issue with #weekDay be fixed?
>>
>> cheers
>> Johan
>

Reply | Threaded
Open this post in threaded view
|

Re: Datetime issues

Johan Brichau-2
In reply to this post by Dale Henrichs
Hi Dale,

The #weekDay message was indeed wrong in my email and should be #dayOfWeek. So it becomes:

DateAndTime now midnight dayOfWeek = DateAndTime now dayOfWeek

If I'm evaluating the above expression in Pharo1.1.1, I'm getting true (as it should be).
In GLASS 1.0-beta8.6, I'm getting false. The left-hand side of the comparison is 5 and the right-hand side is 6. The right-hand side is wrong (it's still friday morning and not saturday ;-)

However, coming back to the originating problem (i.e. the fact that I saw that "Week current" was one day off in GS): I'm indeed not seeing that anymore in a fresh GLASS 1.0-beta8.6
I will investigate this a little deeper today because I just noticed that DateAndTime is now disregarding the timezone setting (for some reason).

Thanks for looking into this, I did not have the chance to dive it into it any further yet.
I'm getting back to you today.

Johan

On 24 Mar 2011, at 17:41, Dale Henrichs wrote:

> Johan,
>
> Well, I'm finally taking a look at this (I usually claim that I am nine months behind, so maybe I am finally catching up?).
>
> I'm tracking this with issue 198 (http://code.google.com/p/glassdb/issues/detail?id=198)..and I am not able to reproduce your problem on a couple of fronts ...
>
> the method weekCay doesn't appear to be implemented in DateAndTime (in Pharo or GemStone) and if I replace weekDay with dayOfWeek, I don't have the issue with midnight ...
>
> I assume that there is a bug in here somewhere, so I will look a little deeper...
>
> I guess I'm curious if you are still seeing the problem and if so what version of GLASS you're using (I think the work over last summer did involve monkeying with #midnight) and then some help to reproduce the bug in my environment ...
>
> Dale
>
> On Nov 17, 2010, at 1:34 PM, Johan Brichau wrote:
>
>> Hi,
>>
>> I'm having a disagreement with the Date-Time library in Gemstone.
>>
>> When you evaluate 'Week current', the returned timespan is off by one day, i.e. the week starts a day later than the Week>>startDay that you had set.
>> For example, if you had set a week's startday to sunday, the week that is returned will start on monday.
>> If you had set a week's startday to monday, the week that is returned will start on tuesday, etc...
>>
>> I traced the issue and found out that in Gemstone, the following is not true:
>>
>> DateAndTime now midnight weekDay = DateAndTime now weekDay
>>
>> Conversely, in Pharo, this is true and because Week>>current has the same implementation in both Pharo and Gemstone, the result is different in Gemstone.
>>
>> The easiest fix would be to leave out the use of #midnight in the implementation of Week>>current, but that would mean Gemstone needs a different version for the Chronos package than Pharo.
>>
>> Or should the issue with #weekDay be fixed?
>>
>> cheers
>> Johan
>

Reply | Threaded
Open this post in threaded view
|

Re: Datetime issues

Johan Brichau-2
In reply to this post by Dale Henrichs
Dale,

I confirm: issues 198 and 148 are identical.

I tested the fix for #198 and it solves the problem.

(I should have read all my emails before answering the previous one;-)

thanks!
Johan

On 24 Mar 2011, at 18:10, Dale Henrichs wrote:

> Johan,
>
> While I am unable to reproduce the problem it _is_ worth noting that Issue148 (which I just fixed) does involve an error in the base image, where DateAndTime>>dayOfWeek was not calculated using local time ... I haven't seen a difference in testing in my image, but I would imagine that at the right time of day relative to your offset from GMT that at least the dayOfWeek calculation would be wrong ...
>
> So, for the moment, I am going to assume that Issue 198 is the same as Issue 148 ...
>
> Dale
>
> On Mar 24, 2011, at 9:41 AM, Dale Henrichs wrote:
>
>> Johan,
>>
>> Well, I'm finally taking a look at this (I usually claim that I am nine months behind, so maybe I am finally catching up?).
>>
>> I'm tracking this with issue 198 (http://code.google.com/p/glassdb/issues/detail?id=198)..and I am not able to reproduce your problem on a couple of fronts ...
>>
>> the method weekCay doesn't appear to be implemented in DateAndTime (in Pharo or GemStone) and if I replace weekDay with dayOfWeek, I don't have the issue with midnight ...
>>
>> I assume that there is a bug in here somewhere, so I will look a little deeper...
>>
>> I guess I'm curious if you are still seeing the problem and if so what version of GLASS you're using (I think the work over last summer did involve monkeying with #midnight) and then some help to reproduce the bug in my environment ...
>>
>> Dale
>>
>> On Nov 17, 2010, at 1:34 PM, Johan Brichau wrote:
>>
>>> Hi,
>>>
>>> I'm having a disagreement with the Date-Time library in Gemstone.
>>>
>>> When you evaluate 'Week current', the returned timespan is off by one day, i.e. the week starts a day later than the Week>>startDay that you had set.
>>> For example, if you had set a week's startday to sunday, the week that is returned will start on monday.
>>> If you had set a week's startday to monday, the week that is returned will start on tuesday, etc...
>>>
>>> I traced the issue and found out that in Gemstone, the following is not true:
>>>
>>> DateAndTime now midnight weekDay = DateAndTime now weekDay
>>>
>>> Conversely, in Pharo, this is true and because Week>>current has the same implementation in both Pharo and Gemstone, the result is different in Gemstone.
>>>
>>> The easiest fix would be to leave out the use of #midnight in the implementation of Week>>current, but that would mean Gemstone needs a different version for the Chronos package than Pharo.
>>>
>>> Or should the issue with #weekDay be fixed?
>>>
>>> cheers
>>> Johan
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Datetime issues

Dale Henrichs
haha...and I should have dug into the problem sooner:)

Dale

On Mar 25, 2011, at 12:36 AM, Johan Brichau wrote:

> Dale,
>
> I confirm: issues 198 and 148 are identical.
>
> I tested the fix for #198 and it solves the problem.
>
> (I should have read all my emails before answering the previous one;-)
>
> thanks!
> Johan
>
> On 24 Mar 2011, at 18:10, Dale Henrichs wrote:
>
>> Johan,
>>
>> While I am unable to reproduce the problem it _is_ worth noting that Issue148 (which I just fixed) does involve an error in the base image, where DateAndTime>>dayOfWeek was not calculated using local time ... I haven't seen a difference in testing in my image, but I would imagine that at the right time of day relative to your offset from GMT that at least the dayOfWeek calculation would be wrong ...
>>
>> So, for the moment, I am going to assume that Issue 198 is the same as Issue 148 ...
>>
>> Dale
>>
>> On Mar 24, 2011, at 9:41 AM, Dale Henrichs wrote:
>>
>>> Johan,
>>>
>>> Well, I'm finally taking a look at this (I usually claim that I am nine months behind, so maybe I am finally catching up?).
>>>
>>> I'm tracking this with issue 198 (http://code.google.com/p/glassdb/issues/detail?id=198)..and I am not able to reproduce your problem on a couple of fronts ...
>>>
>>> the method weekCay doesn't appear to be implemented in DateAndTime (in Pharo or GemStone) and if I replace weekDay with dayOfWeek, I don't have the issue with midnight ...
>>>
>>> I assume that there is a bug in here somewhere, so I will look a little deeper...
>>>
>>> I guess I'm curious if you are still seeing the problem and if so what version of GLASS you're using (I think the work over last summer did involve monkeying with #midnight) and then some help to reproduce the bug in my environment ...
>>>
>>> Dale
>>>
>>> On Nov 17, 2010, at 1:34 PM, Johan Brichau wrote:
>>>
>>>> Hi,
>>>>
>>>> I'm having a disagreement with the Date-Time library in Gemstone.
>>>>
>>>> When you evaluate 'Week current', the returned timespan is off by one day, i.e. the week starts a day later than the Week>>startDay that you had set.
>>>> For example, if you had set a week's startday to sunday, the week that is returned will start on monday.
>>>> If you had set a week's startday to monday, the week that is returned will start on tuesday, etc...
>>>>
>>>> I traced the issue and found out that in Gemstone, the following is not true:
>>>>
>>>> DateAndTime now midnight weekDay = DateAndTime now weekDay
>>>>
>>>> Conversely, in Pharo, this is true and because Week>>current has the same implementation in both Pharo and Gemstone, the result is different in Gemstone.
>>>>
>>>> The easiest fix would be to leave out the use of #midnight in the implementation of Week>>current, but that would mean Gemstone needs a different version for the Chronos package than Pharo.
>>>>
>>>> Or should the issue with #weekDay be fixed?
>>>>
>>>> cheers
>>>> Johan
>>>
>>
>