Repository navigation
Commit 5eefef9
fix: Floor pre-1970 fractional-second timestamps when encoding to Unix seconds
Datetime and pd.Timestamp values were converted with int(dt.timestamp()),
which truncates toward zero. A pre-1970 instant with a fractional second,
such as 1969-12-31 23:59:59.5 UTC, was stored as 0 (1970-01-01 00:00:00)
instead of -1, while the same instant given as np.datetime64 floored to -1.
Compute whole seconds with exact integer arithmetic in one helper and use
it for UNIX_TIMESTAMP, UNIX_TIMESTAMP_LIST/SET, ZONED_TIMESTAMP and
SCALAR_MAP datetime keys. Naive datetimes are still read as UTC.
Signed-off-by: Sonica-B <shreyaa.boyane@gmail.com>1 parent 029dc95 commit 5eefef9
2 files changed
Lines changed: 56 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
723 | 723 | | |
724 | 724 | | |
725 | 725 | | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
726 | 742 | | |
727 | 743 | | |
728 | 744 | | |
| |||
735 | 751 | | |
736 | 752 | | |
737 | 753 | | |
738 | | - | |
739 | | - | |
740 | | - | |
741 | | - | |
742 | | - | |
| 754 | + | |
743 | 755 | | |
744 | 756 | | |
745 | 757 | | |
| |||
1156 | 1168 | | |
1157 | 1169 | | |
1158 | 1170 | | |
1159 | | - | |
| 1171 | + | |
1160 | 1172 | | |
1161 | 1173 | | |
1162 | 1174 | | |
| |||
1498 | 1510 | | |
1499 | 1511 | | |
1500 | 1512 | | |
1501 | | - | |
1502 | | - | |
| 1513 | + | |
1503 | 1514 | | |
1504 | 1515 | | |
1505 | 1516 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
109 | 110 | | |
110 | 111 | | |
111 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
112 | 149 | | |
113 | 150 | | |
114 | 151 | | |
| |||
0 commit comments