I wrote: > I wonder if we could make things better just by using rint() rather than > a naive cast-to-integer. The cast will truncate not round, and I think > that might be what's mostly biting you. Does this help for you?
> #ifdef HAVE_INT64_TIMESTAMP > - result = seconds * USECS_PER_SEC; > + result = rint(seconds * USECS_PER_SEC); > #else I poked around looking for possible similar issues elsewhere, and found that a substantial majority of the datetime-related code already uses rint() when trying to go from float to int representations. As far as I can find, this function and make_interval() are the only ones that fail to do so. So I'm now thinking that this is a clear oversight, and both those places need to be patched to use rint(). regards, tom lane -- Sent via pgsql-hackers mailing list (firstname.lastname@example.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers