forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit87de80e
committed
I think I've finally identified the cause of the off-by-one-second
issue in timestamp conversion that we hacked around for so long byignoring the seconds field from localtime(). It's simple: you haveto watch out for platform-specific roundoff error when reducing apossibly-fractional timestamp to integral time_t form. In particularwe should subtract off the already-determined fractional fsec field.This should be enough to get an exact answer with int64 timestamps;with float timestamps, throw in a rint() call just to be sure.1 parentd534b9e commit87de80e
1 file changed
+17
-13
lines changedLines changed: 17 additions & 13 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
933 | 933 |
| |
934 | 934 |
| |
935 | 935 |
| |
936 |
| - | |
| 936 | + | |
937 | 937 |
| |
938 | 938 |
| |
939 |
| - | |
940 |
| - | |
| 939 | + | |
941 | 940 |
| |
942 | 941 |
| |
943 |
| - | |
944 |
| - | |
| 942 | + | |
945 | 943 |
| |
946 | 944 |
| |
947 | 945 |
| |
948 | 946 |
| |
949 | 947 |
| |
950 |
| - | |
951 |
| - | |
952 | 948 |
| |
953 | 949 |
| |
954 | 950 |
| |
| |||
983 | 979 |
| |
984 | 980 |
| |
985 | 981 |
| |
986 |
| - | |
| 982 | + | |
987 | 983 |
| |
988 | 984 |
| |
989 | 985 |
| |
990 |
| - | |
| 986 | + | |
991 | 987 |
| |
992 | 988 |
| |
993 | 989 |
| |
| |||
1014 | 1010 |
| |
1015 | 1011 |
| |
1016 | 1012 |
| |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
1017 | 1020 |
| |
1018 |
| - | |
1019 |
| - | |
| 1021 | + | |
| 1022 | + | |
1020 | 1023 |
| |
1021 |
| - | |
| 1024 | + | |
| 1025 | + | |
1022 | 1026 |
| |
1023 | 1027 |
| |
1024 | 1028 |
| |
|
0 commit comments
Comments
(0)