Repository navigation
Commit 411c34d
committed
fix(fcm): encode durations without floating-point rounding errors
encode_ttl and encode_milliseconds computed the nanoseconds from the
float returned by timedelta.total_seconds(), so some durations were
sent with rounding errors: an AndroidConfig.ttl of 86400.9 seconds (or
timedelta(days=1, microseconds=900000)) was encoded as
"86400.899999999s", and 1.123457 as "1.123456999s". The Duration
string is now built from the exact days/seconds/microseconds of the
timedelta.1 parent de45607 commit 411c34d
2 files changed
Lines changed: 15 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | 19 | | |
21 | 20 | | |
22 | 21 | | |
| |||
275 | 274 | | |
276 | 275 | | |
277 | 276 | | |
278 | | - | |
279 | | - | |
| 277 | + | |
280 | 278 | | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
| 279 | + | |
286 | 280 | | |
287 | 281 | | |
288 | 282 | | |
| |||
294 | 288 | | |
295 | 289 | | |
296 | 290 | | |
297 | | - | |
298 | | - | |
| 291 | + | |
299 | 292 | | |
300 | | - | |
301 | | - | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
302 | 302 | | |
303 | 303 | | |
304 | 304 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
466 | 466 | | |
467 | 467 | | |
468 | 468 | | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
469 | 472 | | |
470 | 473 | | |
471 | 474 | | |
| |||
0 commit comments