strange time differences - Mailing list pgsql-bugs
| From | Ulf Mehlig |
|---|---|
| Subject | strange time differences |
| Date | |
| Msg-id | c2c306d2275a856d285b4f64c6927904 Whole thread Raw |
| List | pgsql-bugs |
I mentioned the problem described below in the psql-general list, but
didn't get any reply. Maybe someone has already posted it to you, but
anyway, this seems the right place for may-be-bugs, isn't it?
============================================================================
POSTGRESQL BUG REPORT TEMPLATE
============================================================================
Your name : Ulf Mehlig
Your email address : umehlig@uni-bremen.de
System Configuration
- ---------------------
Architecture (example: Intel Pentium) : intel Pentium II
Operating System (example: Linux 2.0.26 ELF) : Linux 2.0.35 ELF,
DLD 5.4 Distribution
PostgreSQL version (example: PostgreSQL-6.4) : PostgreSQL-6.4 (and
6.3.2, too)
Compiler used (example: gcc 2.8.0) : gcc 2.7.2.3
Please enter a FULL description of your problem:
- ------------------------------------------------
Subtracting one datetime value from another with `time' parts beeing
both 00:00 h gives a reasonable time difference, but if the second
datetime's `time' part is 00:01 h (or even 00:00:01, or something
else), there is a difference to the previous calculated value of about
7 days. Seems to be restricted to large time spans.
Please describe a way to repeat the problem. Please try to provide a
concise reproducible example, if at all possible:
- ----------------------------------------------------------------------
=> select date_part ('epoch', age(datetime('29.02.2000','00:00'),
datetime('29.02.1968','00:00')));
date_part
----------
1009843200
^
=> select date_part ('epoch', age(datetime('29.02.2000','00:00'),
datetime('29.02.1968','00:01')));
date_part
----------
1009303140
^
Difference is 60 seconds + 54000 secs for free! ;-)
This calculation is correct:
=> select date_part ('epoch', age(datetime('01.01.1998', '00:00'),
datetime('01.01.1998', '00:01')));
date_part
- ---------
-60
(1 row)
... but it's not a year-2000-problem nor victim of 29th of February,
is it?!
=> select date_part ('epoch', age(datetime('01.01.1998', '00:00'),
datetime('01.01.1968', '00:00')));
date_part
- ---------
946728000
(1 row)
=> select date_part ('epoch', age(datetime('01.01.1998', '00:00'),
datetime('01.01.1968', '00:01')));
date_part
- ---------
946360740
(1 row)
(only four days gained.)
If you know how this problem might be fixed, list the solution below:
- ---------------------------------------------------------------------
no idea ;-) Do you (or some library) handle dates internally as
float values?
Best regards,
Ulf
- --
======================================================================
%%%%% Ulf Mehlig <umehlig@zmt.uni-bremen.de>
%%%%!%%% Projekt "MADAM" <umehlig@uni-bremen.de>
%%%% %!% %%%% ----------------------------------------------------
---| %%% MADAM: MAngrove | Center for Tropical Marine
||--%!% Dynamics | Biology
|| And | Fahrenheitstrasse 1
_ /||\_/\_ Management |
/ / \ \ ~~~~~~~~~~~~~~~~~ | 28359 Bremen/Germany
~~~~~~~~~~~~~~~~~~~~
pgsql-bugs by date: