Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id E34931337B56 for ; Mon, 27 Dec 2010 22:23:12 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 67593-08 for ; Tue, 28 Dec 2010 02:23:05 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from nm14-vm0.bullet.mail.sp2.yahoo.com (nm14-vm0.bullet.mail.sp2.yahoo.com [98.139.91.246]) by mail.postgresql.org (Postfix) with SMTP id 0CA1B1336971 for ; Mon, 27 Dec 2010 22:23:04 -0400 (AST) Received: from [98.139.91.64] by nm14.bullet.mail.sp2.yahoo.com with NNFMP; 28 Dec 2010 02:23:03 -0000 Received: from [98.139.91.4] by tm4.bullet.mail.sp2.yahoo.com with NNFMP; 28 Dec 2010 02:23:03 -0000 Received: from [127.0.0.1] by omp1004.mail.sp2.yahoo.com with NNFMP; 28 Dec 2010 02:23:03 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 930948.88094.bm@omp1004.mail.sp2.yahoo.com Received: (qmail 88857 invoked by uid 60001); 28 Dec 2010 02:23:03 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1293502983; bh=IUw1ywIna9wWVe44jearoz5jJSW0IJWh/z+q/oTy1Y4=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type; b=tuVoeVqZLkOvbWhpKb4Wy77Lnq9C8rVJYj8VyJyvoSuTrv0yMV8fkKR9qgCVXRHYkH8aHXsfg5vOpmb2oXWo07MOXw/NOVDny/Mijih9pM+3qQ9OQg1r7XxWozxkODSIPh8W79W+e1sNFJ9SFlZvn8e2r4qsA+wsmIlsFdG9SOQ= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type; b=c5wC83OymymUEBqBoo10zAHnccarx1gURxtZ9GM/eFBA5cgdCx+IoeAvQsW4UfWnohzCNR3IDBLBn1epI+KMtUEOcleiomLU3LWIddhVaGy91RYj9/N3Zl/mttvxYhVDVV6sClDGHiPqG6gVubump2Kb1AUCLiHqw4hau94BTaQ=; Message-ID: <370742.86201.qm@web110704.mail.gq1.yahoo.com> X-YMail-OSG: Ls6tQMIVM1nL2.IiFz4VMBgeqlGtp5qPY4Ml0QIrLk6zV4j fQr5FoWJiOCdFIsQ7jjLsb5v1X1mnQ90JlbJgxXPw3qNlKoaysDMSv.8JYDb myIMIAWqNFLNTURS5HGZdhOHmmRmHQJ4W0r4n99Oj2gO36A_.DcCWT6fttQx 0uCCt44ZnN2Qb9McTmmMGaSJOCOpa1t6tbaV5x6HmVmJjL0rHrVhkD2.MHoW mMq_wY8bkYdicw6Gu9whsQdSZnWvvwIKYyFipjGPe6B197XLPlPGAyqlw9dd 6PolkBO4qxWkoTPa4L948is9fKCXQC0bWFp3c8TempdbvaxUBqeOCRR8w5TH 6AcH6xO7w.W5Sp1L94vm4M_LDw1328s40DDMOVo4eHgC2SIhWU5NQSNVpl9A mhkWLpBgkwMc- Received: from [65.94.247.127] by web110704.mail.gq1.yahoo.com via HTTP; Mon, 27 Dec 2010 18:23:03 PST X-Mailer: YahooMailClassic/11.4.20 YahooMailWebService/0.8.107.285259 Date: Mon, 27 Dec 2010 18:23:03 -0800 (PST) From: Leslie S Satenstein Subject: Some comments about Julian Dates and possible bug. Please provide feedback. To: pgsql-docs Cc: Robert Haas In-Reply-To: <1292852119-sup-7799@alvh.no-ip.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.908 tagged_above=-5 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RFC_ABUSE_POST=0.001, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201012/43 X-Sequence-Number: 6279 Hi Robert, If my email is not for the documentation group, please forward. I am not sure if this has meaning to PG users. In the 9.0.2 PG documentation that was posted concerning Julian dates, I noted that comments stated that Julian dates were used mainly for astronomical calculations. I would like to let you know the importance of Julian dates in the ERP manufacturing sector. In fact, here is how it is used. In the factory, work and material scheduling, as well as material requirements planning usually refers to a manufacturing calendar. These calendars often have 1000 working days to a manufacturing year. Using Julian dates in the software makes it easy to calculate target dates x working days after a given day. Calculations to take the Gregorian date, convert it to Julian, and then add a duration quantity before converting back, is where the use of the julian date shines. Calculations for differences between two dates is important and easily done. I found the Julian date code that is programmed in Postgres, to be accurate and fast except for one situation. But, I do have one or two questions. 1) Which calendar is being used? In the Gregorian Calendar, January 1, 0001 is lowest positive date. The day before 1/1/0001, according to the Gregorian calendar is December 31,-0001 in which the year has a value of negative one --- there is no zero year in the Gregorian Calendar. (zero year is an error) I tested and found the algorithm in Postgres to have the day before January 1,0001 calculating as December 31,0000 even though the world calculates the day before January 1,0001 as December 31,-0001. 2) Is the algorithm in Postgres correct? I think not, as the calculations for the difference in days between January 1, 0001 and December 31,-0001 is not 367 days, but just the value 1. To convert the code to work with the Gregorian calendar takes two fixes to two sub-routines. Each fix is two lines of C code. I have tested the PG Date C language routines with/without my fix, starting with the year around -4713 to several centuries into the future. As long as both versions calculate Julian dates that are later than 1/1/0001, both the PG and my fixed versions respecting Gregorian algorithms produce identical results. 3) Does PG want to fully follow the Gregorian Calendar rule? If so, 4) do they want my one patch with two fixes6 Regards Leslie (celebrating 40 years in IT).