patch.dt.c
text/plain
diff -cr pgsql-orig/src/backend/utils/adt/dt.c pgsql/src/backend/utils/adt/dt.c
*** pgsql-orig/src/backend/utils/adt/dt.c Fri Jan 9 08:01:37 1998
--- pgsql/src/backend/utils/adt/dt.c Thu Jan 15 17:13:26 1998
***************
*** 66,73 ****
--- 66,77 ----
/* TMODULO()
* Macro to replace modf(), which is broken on some platforms.
*/
+ #if __GLIBC__ < 2
#define TMODULO(t,q,u) {q = ((t < 0)? ceil(t / u): floor(t / u)); \
if (q != 0) t -= rint(q * u);}
+ #else
+ #define TMODULO(t,q,u) {double d; (void) modf(t/u, &d); q = d; t -= (q * u);}
+ #endif
static void GetEpochTime(struct tm * tm);
***************
*** 4163,4169 ****
sec = (tm->tm_sec + fsec);
sprintf(str, "%02d:%02d:", tm->tm_hour, tm->tm_min);
! sprintf((str + 6), ((fsec != 0) ? "%05.2f" : "%02.0f"), sec);
#ifdef DATEDEBUG
printf("EncodeTimeOnly- time result is %s\n", str);
--- 4167,4173 ----
sec = (tm->tm_sec + fsec);
sprintf(str, "%02d:%02d:", tm->tm_hour, tm->tm_min);
! sprintf((str + 6), ((fsec != rint(fsec)) ? "%05.2f" : "%02.0f"), sec);
#ifdef DATEDEBUG
printf("EncodeTimeOnly- time result is %s\n", str);
***************
*** 4221,4227 ****
{
sprintf(str, "%04d-%02d-%02d %02d:%02d:",
tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min);
! sprintf((str + 17), ((fsec != 0) ? "%05.2f" : "%02.0f"), sec);
if ((*tzn != NULL) && (tm->tm_isdst >= 0))
{
--- 4225,4231 ----
{
sprintf(str, "%04d-%02d-%02d %02d:%02d:",
tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min);
! sprintf((str + 17), ((fsec != rint(fsec)) ? "%05.2f" : "%02.0f"), sec);
if ((*tzn != NULL) && (tm->tm_isdst >= 0))
{
***************
*** 4314,4320 ****
if (tm->tm_year > 0)
{
sprintf((str + 10), " %02d:%02d", tm->tm_hour, tm->tm_min);
! if (fsec != 0)
{
sprintf((str + 16), ":%05.2f %04d", sec, tm->tm_year);
if ((*tzn != NULL) && (tm->tm_isdst >= 0))
--- 4318,4324 ----
if (tm->tm_year > 0)
{
sprintf((str + 10), " %02d:%02d", tm->tm_hour, tm->tm_min);
! if (fsec != rint(fsec))
{
sprintf((str + 16), ":%05.2f %04d", sec, tm->tm_year);
if ((*tzn != NULL) && (tm->tm_isdst >= 0))
diff -cr pgsql-orig/src/include/config.h.in pgsql/src/include/config.h.in
*** pgsql-orig/src/include/config.h.in Sat Dec 20 04:26:27 1997
--- pgsql/src/include/config.h.in Thu Jan 15 17:01:59 1998
***************
*** 62,69 ****
--- 62,71 ----
extern int gethostname(char *name, int namelen);
#endif
+ #if __GLIBC__ < 2
/* Set to 1 if you have int timezone */
#undef HAVE_INT_TIMEZONE
+ #endif
/* Set to 1 if you have cbrt() */
#undef HAVE_CBRT