NpgsqlInterval different constructors different ToString #152

Closed
DavidKarlas opened this Issue Jan 31, 2014 · 2 comments

Projects

None yet

3 participants

@DavidKarlas
Contributor
var interval = new NpgsqlTypes.NpgsqlInterval(1, 2, 3, 4, 5);
var intervalFromTimespan = new NpgsqlTypes.NpgsqlInterval(new TimeSpan(1, 2, 3, 4, 5));
Console.WriteLine("Interval              :"+interval);
Console.WriteLine("Interval from timespan:" + intervalFromTimespan);

Output:

Interval              :1 day 02:03:04.005
Interval from timespan:26:03:04.005

First I thought that is 26 days :) then realized that it's just represented in hours... Can this be considered as bug?

@franciscojunior
Member

This is definitely a bug! It should show the same output string.

I'll add the proper label on it.

Thanks for heads up, David!

@glenebob glenebob added a commit that referenced this issue Feb 1, 2014
@glenebob glenebob Fix byug #152: NpgsqlInterval different constructors different ToString
Call a more appropriate constructor from NpgsqlInterval(TimeSpan).
fd99912
@glenebob glenebob was assigned Feb 1, 2014
@franciscojunior franciscojunior added a commit to franciscojunior/Npgsql that referenced this issue Feb 4, 2014
@franciscojunior franciscojunior Add test for pr #152 049bbc3
@franciscojunior franciscojunior added a commit to franciscojunior/Npgsql that referenced this issue Feb 4, 2014
@franciscojunior franciscojunior Add test for pr #152 6504609
@Tradioyes Tradioyes added a commit to Tradioyes/Npgsql that referenced this issue Apr 10, 2014
@Tradioyes Tradioyes Fix bug #152: NpgsqlInterval different constructors different ToString
Take the days from the Timespan, then the remaining ticks.
NpgsqlInterval(long) now calls NpgsqlInterval(TimeSpan) to make TimeSpan
do the division work.
Largely inspired by commit fd99912 from
glenebob
dbf51a6
@franciscojunior franciscojunior added a commit to franciscojunior/Npgsql that referenced this issue Apr 11, 2014
@franciscojunior franciscojunior Fix PR #152
Change constructors to handle ticks with more than 30 days.
b99ac42
@franciscojunior franciscojunior added this to the 2.2 milestone Apr 11, 2014
@Emill Emill added a commit to Emill/Npgsql that referenced this issue Jun 13, 2014
@Tradioyes @Emill Tradioyes + Emill Fix bug #152: NpgsqlInterval different constructors different ToString
Take the days from the Timespan, then the remaining ticks.
NpgsqlInterval(long) now calls NpgsqlInterval(TimeSpan) to make TimeSpan
do the division work.
Largely inspired by commit fd99912 from
glenebob
a1f3a15
@franciscojunior
Member

Fixed by #211. Closing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment