Mario Splivalo <mario.splivalo@megafon.hr> writes:
> But, date_trunc behaves like round function: round(1.9) = 2.
Hmm ... only for float timestamps, and only for the millisec/microsec
cases.
case DTK_MILLISEC:
#ifdef HAVE_INT64_TIMESTAMP fsec = (fsec / 1000) * 1000;
#else fsec = rint(fsec * 1000) / 1000;
#endif break; case DTK_MICROSEC:
#ifndef HAVE_INT64_TIMESTAMP fsec = rint(fsec * 1000000) / 1000000;
#endif break;
I wonder if we should change this to use floor() instead.
regards, tom lane