You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Richard Liang <ri...@gmail.com> on 2006/08/29 10:30:39 UTC
[classlib][sql] Another confusing behavior: java.sql.Timestamp
Hello All,
RI's java.sql.Timestamp(long time) behaves confusing when the
parameter time is in Long.MIN_VALUE. Shall we follow RI?
Output of the following sample is:
time: -9223372036854775808
time: 9223372036854775192
timestamp: 292278994-08-17 15:12:55.192
timestamp: 292278994-08-17 15:12:55.192
=========================================
import java.sql.Timestamp;
public class TimeStampTest {
public static void main(String[] args) {
long time = Long.MIN_VALUE;
long time2 = 9223372036854775192l;
Timestamp timestamp = new Timestamp(time);
Timestamp timestamp2 = new Timestamp(time2);
System.out.println("time: " + time);
System.out.println("time: " + time2);
System.out.println("timestamp: " + timestamp);
System.out.println("timestamp: " + timestamp2);
}
}
--
Richard Liang
China Software Development Lab, IBM
---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org
Re: [classlib][sql] Another confusing behavior: java.sql.Timestamp
Posted by Richard Liang <ri...@gmail.com>.
Hello,
I have raised Harmony-1400[1] for this issue. Thanks a lot.
[1]http://issues.apache.org/jira/browse/HARMONY-1400
Best regards,
Richard.
On 8/30/06, Richard Liang <ri...@gmail.com> wrote:
>
>
> Geir Magnusson Jr. wrote:
> > 1) What should it do?
>
> When calculating nanos value, underflow may occur if the given time is
> near Long.MIN_VALUE. In fact, I'm also not sure what it should do. Just
> notice that RI handles the underflow situation in a special/confusing
> way, while Harmony does not have any handling.
>
> >
> > 2) if it's just a single value, why not fix it and never have to deal
> > w/ it again? Is it an easy fix?
> Yes, the fix is quite easy. Do you mean we shall follow RI?
>
> Thanks a lot.
>
> Richard.
> >
> > geir
> >
> >
> >
> > Anton Luht wrote:
> >> Hello,
> >>
> >> I don't think we should bother about single value which is very
> >> unlikely to happpen in real data.
> >>
> >> On 8/29/06, Richard Liang <ri...@gmail.com> wrote:
> >>> Hello All,
> >>>
> >>> RI's java.sql.Timestamp(long time) behaves confusing when the
> >>> parameter time is in Long.MIN_VALUE. Shall we follow RI?
> >>>
> >>> Output of the following sample is:
> >>> time: -9223372036854775808
> >>> time: 9223372036854775192
> >>> timestamp: 292278994-08-17 15:12:55.192
> >>> timestamp: 292278994-08-17 15:12:55.192
> >>>
> >>>
> >>> =========================================
> >>> import java.sql.Timestamp;
> >>>
> >>> public class TimeStampTest {
> >>> public static void main(String[] args) {
> >>> long time = Long.MIN_VALUE;
> >>> long time2 = 9223372036854775192l;
> >>> Timestamp timestamp = new Timestamp(time);
> >>> Timestamp timestamp2 = new Timestamp(time2);
> >>>
> >>> System.out.println("time: " + time);
> >>> System.out.println("time: " + time2);
> >>>
> >>> System.out.println("timestamp: " + timestamp);
> >>> System.out.println("timestamp: " + timestamp2);
> >>> }
> >>> }
> >>>
> >>>
> >>> --
> >>> Richard Liang
> >>> China Software Development Lab, IBM
> >>>
> >>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> Terms of use : http://incubator.apache.org/harmony/mailing.html
> >>> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> >>> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
> >>>
> >>>
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > Terms of use : http://incubator.apache.org/harmony/mailing.html
> > To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> > For additional commands, e-mail: harmony-dev-help@incubator.apache.org
> >
> >
>
> --
> Richard Liang
> China Software Development Lab, IBM
>
>
>
> ---------------------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>
>
--
Richard Liang
China Software Development Lab, IBM
---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org
Re: [classlib][sql] Another confusing behavior: java.sql.Timestamp
Posted by Richard Liang <ri...@gmail.com>.
Geir Magnusson Jr. wrote:
> 1) What should it do?
When calculating nanos value, underflow may occur if the given time is
near Long.MIN_VALUE. In fact, I'm also not sure what it should do. Just
notice that RI handles the underflow situation in a special/confusing
way, while Harmony does not have any handling.
>
> 2) if it's just a single value, why not fix it and never have to deal
> w/ it again? Is it an easy fix?
Yes, the fix is quite easy. Do you mean we shall follow RI?
Thanks a lot.
Richard.
>
> geir
>
>
>
> Anton Luht wrote:
>> Hello,
>>
>> I don't think we should bother about single value which is very
>> unlikely to happpen in real data.
>>
>> On 8/29/06, Richard Liang <ri...@gmail.com> wrote:
>>> Hello All,
>>>
>>> RI's java.sql.Timestamp(long time) behaves confusing when the
>>> parameter time is in Long.MIN_VALUE. Shall we follow RI?
>>>
>>> Output of the following sample is:
>>> time: -9223372036854775808
>>> time: 9223372036854775192
>>> timestamp: 292278994-08-17 15:12:55.192
>>> timestamp: 292278994-08-17 15:12:55.192
>>>
>>>
>>> =========================================
>>> import java.sql.Timestamp;
>>>
>>> public class TimeStampTest {
>>> public static void main(String[] args) {
>>> long time = Long.MIN_VALUE;
>>> long time2 = 9223372036854775192l;
>>> Timestamp timestamp = new Timestamp(time);
>>> Timestamp timestamp2 = new Timestamp(time2);
>>>
>>> System.out.println("time: " + time);
>>> System.out.println("time: " + time2);
>>>
>>> System.out.println("timestamp: " + timestamp);
>>> System.out.println("timestamp: " + timestamp2);
>>> }
>>> }
>>>
>>>
>>> --
>>> Richard Liang
>>> China Software Development Lab, IBM
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> Terms of use : http://incubator.apache.org/harmony/mailing.html
>>> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
>>> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>>>
>>>
>>
>>
>
> ---------------------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>
>
--
Richard Liang
China Software Development Lab, IBM
---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org
Re: [classlib][sql] Another confusing behavior: java.sql.Timestamp
Posted by "Geir Magnusson Jr." <ge...@pobox.com>.
1) What should it do?
2) if it's just a single value, why not fix it and never have to deal w/
it again? Is it an easy fix?
geir
Anton Luht wrote:
> Hello,
>
> I don't think we should bother about single value which is very
> unlikely to happpen in real data.
>
> On 8/29/06, Richard Liang <ri...@gmail.com> wrote:
>> Hello All,
>>
>> RI's java.sql.Timestamp(long time) behaves confusing when the
>> parameter time is in Long.MIN_VALUE. Shall we follow RI?
>>
>> Output of the following sample is:
>> time: -9223372036854775808
>> time: 9223372036854775192
>> timestamp: 292278994-08-17 15:12:55.192
>> timestamp: 292278994-08-17 15:12:55.192
>>
>>
>> =========================================
>> import java.sql.Timestamp;
>>
>> public class TimeStampTest {
>> public static void main(String[] args) {
>> long time = Long.MIN_VALUE;
>> long time2 = 9223372036854775192l;
>> Timestamp timestamp = new Timestamp(time);
>> Timestamp timestamp2 = new Timestamp(time2);
>>
>> System.out.println("time: " + time);
>> System.out.println("time: " + time2);
>>
>> System.out.println("timestamp: " + timestamp);
>> System.out.println("timestamp: " + timestamp2);
>> }
>> }
>>
>>
>> --
>> Richard Liang
>> China Software Development Lab, IBM
>>
>>
>>
>> ---------------------------------------------------------------------
>> Terms of use : http://incubator.apache.org/harmony/mailing.html
>> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
>> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>>
>>
>
>
---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org
Re: [classlib][sql] Another confusing behavior: java.sql.Timestamp
Posted by Anton Luht <an...@gmail.com>.
Hello,
I don't think we should bother about single value which is very
unlikely to happpen in real data.
On 8/29/06, Richard Liang <ri...@gmail.com> wrote:
> Hello All,
>
> RI's java.sql.Timestamp(long time) behaves confusing when the
> parameter time is in Long.MIN_VALUE. Shall we follow RI?
>
> Output of the following sample is:
> time: -9223372036854775808
> time: 9223372036854775192
> timestamp: 292278994-08-17 15:12:55.192
> timestamp: 292278994-08-17 15:12:55.192
>
>
> =========================================
> import java.sql.Timestamp;
>
> public class TimeStampTest {
> public static void main(String[] args) {
> long time = Long.MIN_VALUE;
> long time2 = 9223372036854775192l;
> Timestamp timestamp = new Timestamp(time);
> Timestamp timestamp2 = new Timestamp(time2);
>
> System.out.println("time: " + time);
> System.out.println("time: " + time2);
>
> System.out.println("timestamp: " + timestamp);
> System.out.println("timestamp: " + timestamp2);
> }
> }
>
>
> --
> Richard Liang
> China Software Development Lab, IBM
>
>
>
> ---------------------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>
>
--
Regards,
Anton Luht,
Intel Middleware Products Division
---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org