Commit graph

38 commits

Author SHA1 Message Date
Brent Rubell
3bc22c5753
Merge pull request #8 from adafruit/jepler-integer-total_seconds
total_seconds: Fix precision problem
2021-03-26 11:01:08 -04:00
13f93325d3 total_seconds: Fix precision problem
Since CircuitPython floats have very small precision, the "total_seconds"
method was not very useful for large timedeltas.

Instead of always returning a float, use pure-integer arithmetic (and
return an int) if either:
 * the length of time is big (1<<21 is 2097152 seconds or about 24 days)
 * the number of microseconds is zero

Otherwise, for small values with nonzero microseconds, use floating-point
math.

The cut-off point was chosen because in CircuitPython float arithmetic,
2097151.0+0.5 is different from 2097151.0, but 2097152.0+0.5 and
2097152.0 are *the same float*.
2021-03-22 15:27:49 -05:00
dherrada
c8486780b9 "Increase duplicate code check threshold
"
2021-03-19 13:48:46 -04:00
Brent Rubell
9f20aa1d89
Merge pull request #7 from brentru/fix-failing-tests
Fix failing CI tests on lint
2021-03-17 14:10:38 -04:00
brentru
09b35f5308 last issue 2021-03-17 12:16:21 -04:00
brentru
2ec786a816 lint testdate 2021-03-17 12:09:57 -04:00
brentru
c03b79c522 fixes for time/dt 2021-03-17 12:05:03 -04:00
brentru
3cf6b40960 add date 2021-03-17 12:01:58 -04:00
brentru
85df52cadf pass datetime 2021-03-17 12:00:11 -04:00
brentru
d62b418b27 date 2021-03-17 11:55:00 -04:00
brentru
6c51b42e33 pass time 2021-03-17 11:43:21 -04:00
brentru
759bb66e2d disable linting errors on _time 2021-03-17 11:38:13 -04:00
Scott Shawcroft
c2b7164acb
Merge pull request #6 from cognitivegears/master
Corrected fidelity of datetime.fromtimestamp()
2021-03-11 10:39:35 -08:00
Nathan Byrd
d1f502ffd5 Updated per code review comments 2021-03-10 19:26:34 -06:00
Kattni
c0faca0ea2
Merge pull request #3 from FoamyGuy/pylint_to_pre_commit
pylint to precommit
2021-03-09 11:34:43 -05:00
foamyguy
28c6f5ef25 tests pylint pre-commit hook 2021-03-08 18:31:42 -06:00
Nathan Byrd
371deae98f Corrected fidelity of datetime.fromtimestamp() 2021-03-05 17:23:12 -06:00
Jeff Epler
25f8de0a78
Merge pull request #4 from adafruit/jepler-patch-1
datetime: fix _fromtimestamp for small-range floats
2021-03-03 17:14:18 -06:00
f487c265b6 fix pylint diagnostic 2021-03-03 17:10:02 -06:00
6bfb321707 datetime: fix _fromtimestamp for small-range floats
A typical timestamp is 1614803568. A CircuitPython float's granularity
at this magnitude is several minutes!

By avoiding the use of modf when t is an integer, the `datetime.now()`
classmethod is usable, i.e., it reutnrs a time that increases from second
to second instead of mostly being stuck and occasionally jumping forward.
2021-03-03 14:35:23 -06:00
foamyguy
13337e12bb pylint to precommit 2021-03-02 18:34:46 -06:00
Melissa LeBlanc-Williams
99f35dad3d
Merge pull request #2 from makermelissa/master
Added fromisoformat() to date and datetime
2021-02-19 07:55:21 -08:00
Melissa LeBlanc-Williams
898031f378 Fix error message to match original datetime lib and enabled more unit tests 2021-02-18 16:30:07 -08:00
Melissa LeBlanc-Williams
4e7900b62d Enabled more unit tests 2021-02-18 15:55:53 -08:00
Melissa LeBlanc-Williams
0d1acd12d4 Passing another test. Fixed the separator to be any character 2021-02-18 15:50:33 -08:00
Melissa LeBlanc-Williams
f611e90e5c Implemented Timezone Offset functionality and enabled unit tests 2021-02-18 14:51:49 -08:00
Melissa LeBlanc-Williams
aceaa3594f Finally fixed what build docs was complaining about 2021-02-18 10:47:34 -08:00
Melissa LeBlanc-Williams
da727d5ee1 Allow 3 and 6 decimal floats and update valid format string 2021-02-18 10:42:40 -08:00
Melissa LeBlanc-Williams
4252da7a69 Make docs happy 2021-02-18 10:16:17 -08:00
Melissa LeBlanc-Williams
169afbe2c0 Linted 2021-02-18 10:10:21 -08:00
Melissa LeBlanc-Williams
df458b7257 Added fromisoformat() to date and datetime 2021-02-18 10:03:54 -08:00
dherrada
70a4e69632 Hardcoded Black and REUSE versions
Signed-off-by: dherrada <dylan.herrada@adafruit.com>
2021-02-10 16:32:31 -05:00
Brent Rubell
ffa0ec0f7b
Merge pull request #1 from brentru/fix-cpy-issues
CircuitPython API Compatibility and Bugfixes
2021-01-29 13:56:59 -05:00
brentru
9bd0af32e4 linty 2021-01-27 17:45:19 -05:00
brentru
aa9a48a164 fix pre-commit, installing locally so it doesnt pop error in CI :) 2021-01-27 17:41:14 -05:00
brentru
96b84a60dd add note about lib. footprint 2021-01-27 17:30:16 -05:00
brentru
c115136763 update tests to reflect changes 2021-01-27 17:26:26 -05:00
brentru
820240c9d7 Initial commit! 2021-01-27 15:57:25 -05:00