A bug
Your name : Artur Wroblewski
Your email address : wrobell@posexperts.com.pl
System Configuration
---------------------
Architecture (example: Intel Pentium) : Intel Pentium
Operating System (example: Linux 2.0.26 ELF) : Linux 2.2.5 ELF
PostgreSQL version (example: PostgreSQL-6.5.3): PostgreSQL-6.5.3
Compiler used (example: gcc 2.8.0) : egcs 1.1.2
Please enter a FULL description of your problem:
------------------------------------------------
Lack of support for time/date internationalization
Please describe a way to repeat the problem. Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------
select now()::datetime;
gives always english version
If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------
:)
From bouncefilter Tue Jan 4 09:45:57 2000
Received: from localhost (IDENT:root@hectic-2.jpl.nasa.gov [128.149.68.204])
by hub.org (8.9.3/8.9.3) with ESMTP id JAA79380
for <pgsql-hackers@postgreSQL.org>; Tue, 4 Jan 2000 09:45:37 -0500 (EST)
(envelope-from lockhart@alumni.caltech.edu)
Received: from alumni.caltech.edu (lockhart@localhost [127.0.0.1])
by localhost (8.8.7/8.8.7) with ESMTP id IAA02838;
Tue, 4 Jan 2000 08:11:33 GMT
Sender: lockhart@hub.org
Message-ID: <3871AB34.5ACE74C7@alumni.caltech.edu>
Date: Tue, 04 Jan 2000 08:11:32 +0000
From: Thomas Lockhart <lockhart@alumni.caltech.edu>
X-Mailer: Mozilla 4.6 [en] (X11; I; Linux 2.0.36 i686)
X-Accept-Language: en
MIME-Version: 1.0
To: Tom Lane <tgl@sss.pgh.pa.us>, ohp@pyrenet.fr,
Tulassay Zsolt <zsolt@tek.bke.hu>
CC: pgsql-hackers@postgreSQL.org
Subject: Re: [BUGS] Date calc bug
References: <Pine.UW2.4.21.0001021513050.11391-100000@server.pyrenet.fr>
<21517.946836120@sss.pgh.pa.us>
Content-Type: multipart/mixed; boundary="------------0D67EBB5BB25DC2D84AE64E5"
This is a multi-part message in MIME format.
--------------0D67EBB5BB25DC2D84AE64E5
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
forum=> select datetime(now())+'74565 days'::timespan as ido;
Thu Jan 19 14:07:30 2068
and
select '12-01-1999'::datetime + '@ 1 month - 1 sec' ;
Thu Dec 30 23:59:59 1999 EST
I've repaired both problems in both the development and release trees.
Thanks for the reports and analysis. Patch enclosed...
- Thomas
--
Thomas Lockhart lockhart@alumni.caltech.edu
South Pasadena, California
--------------0D67EBB5BB25DC2D84AE64E5
Content-Type: text/plain; charset=us-ascii;
name="dt.c.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="dt.c.patch"
*** ../src/backend/utils/adt/dt.c.orig Mon Jan 3 08:27:24 2000
--- ../src/backend/utils/adt/dt.c Mon Jan 3 16:41:08 2000
***************
*** 787,792 ****
--- 787,793 ----
* To add a month, increment the month, and use the same day of month.
* Then, if the next month has fewer days, set the day of month
* to the last day of month.
+ * Lastly, add in the "quantitative time".
*/
DateTime *
datetime_pl_span(DateTime *datetime, TimeSpan *span)
***************
*** 815,826 ****
{
dt = (DATETIME_IS_RELATIVE(*datetime) ? SetDateTime(*datetime) : *datetime);
- #ifdef ROUND_ALL
- dt = JROUND(dt + span->time);
- #else
- dt += span->time;
- #endif
-
if (span->month != 0)
{
struct tm tt,
--- 816,821 ----
***************
*** 853,858 ****
--- 848,859 ----
DATETIME_INVALID(dt);
}
+ #ifdef ROUND_ALL
+ dt = JROUND(dt + span->time);
+ #else
+ dt += span->time;
+ #endif
+
*result = dt;
}
***************
*** 2441,2447 ****
tm2timespan(struct tm * tm, double fsec, TimeSpan *span)
{
span->month = ((tm->tm_year * 12) + tm->tm_mon);
! span->time = ((((((tm->tm_mday * 24) + tm->tm_hour) * 60) + tm->tm_min) * 60) + tm->tm_sec);
span->time = JROUND(span->time + fsec);
return 0;
--- 2442,2451 ----
tm2timespan(struct tm * tm, double fsec, TimeSpan *span)
{
span->month = ((tm->tm_year * 12) + tm->tm_mon);
! span->time = ((((((tm->tm_mday * 24.0)
! + tm->tm_hour) * 60.0)
! + tm->tm_min) * 60.0)
! + tm->tm_sec);
span->time = JROUND(span->time + fsec);
return 0;
--------------0D67EBB5BB25DC2D84AE64E5--