summaryrefslogtreecommitdiff
path: root/shared-bindings/time/__init__.c
AgeCommit message (Collapse)Author
2021-03-29Add a missing parameter to an error message (Fixes #4505)James Carr
2021-03-15run code formatting scriptmicroDev
2020-11-25merge from upstream + wipDan Halbert
2020-11-25changed alarm.time APIDan Halbert
2020-09-12doc fix: remove the text about the non-existing clock specificationCarl Karsten
2020-08-07Merge pull request #3252 from ciscorn/pyiJeff Epler
Some improvements to the core module docs
2020-08-07Modify some Python stubsTaku Fukada
2020-08-04Combine similar strings to reduce size of translationsJeff Epler
This is a slight trade-off with code size, in places where a "_varg" mp_raise variant is now used. The net savings on trinket_m0 is just 32 bytes. It also means that the translation will include the original English text, and cannot be translated. These are usually names of Python types such as int, set, or dict or special values such as "inf" or "Nan".
2020-07-17Merge branch 'main' into type_hintsdherrada
2020-07-13Merge pull request #2780 from AndrewR-L/patch-1Scott Shawcroft
busio/UART: Correct and clarify readline() return.
2020-07-06Add license to some obvious files.Diego Elio Pettenò
2020-07-03Added type hints to timedherrada
2020-07-03Made every init return Nonedherrada
2020-07-02Merge branch 'main' into patch-1Scott Shawcroft
2020-05-12Merge remote-tracking branch 'adafruit/master' into improve_verificationScott Shawcroft
2020-05-12Swap sphinx to autoapi and the inline stubsScott Shawcroft
2020-05-12Did time, touchio, uheapdherrada
2020-05-08Throw a NotImplementedError for time functions on boards without long intsDavePutz
Fix for Issue #2812. Instead of reporting a missing attribute for functions such as time.time() and time.mktime(); platforms that do not have long integer support will raise a NotImplementedError
2020-03-16Fix documentation typo: tm_minute should be tm_minDale Hawkins
2020-02-07time.sleep() rounds to nearest msecDan Halbert
2020-02-07improve time.monotonic_ns() accuracy from ms to usDan Halbert
2019-11-26time: struct_time: allow construction like a namedtuple, tooJeff Epler
Whenever there is more than one argument, delegate the operation to namedtuple_make_new. This allows other circuitpython-compatible idioms, like with keywords time.struct_time(tm_year=2000, tm_mon=1, tm_mday=1, tm_hour=0, tm_min=0, tm_sec=14, tm_wday=5, tm_yday=5, tm_isdst=-1) with 9 positional arguments, etc. The only vaguely plausible CPython behavior still not permitted in CircuitPython that I found is constructing a timetuple from a length-9 list, a la time.struct_time(list(time.localtime()) Even better, by getting rid of an error message, the build shrinks a tiny bit.
2019-11-26time: struct_time: allow construction from another struct_timeJeff Epler
This doesn't cover ALL the cases that CPython permits for construction of a struct_time, but it at least makes constructing from any namedtuple work. Closes: #2326
2019-08-18shared-bindings/time: styleJeff Epler
2019-08-17localtime: don't hard-fault on argument type errors; handle localtime(float)Jeff Epler
It turns out `mp_obj_int_get_checked` is not appropriate to call when the argument is not of int or long type--the "checked" refers to guarding against overflow/underflow, not type checking. For compatibility with CPython, handle float arguments. Closes: #2069
2019-07-30BLE: peripheral client pairing (not yet bonding); fix time doc formattingDan Halbert
2019-05-30Improve rST consistency for rst2pyi useScott Shawcroft
2019-01-25 fix kw_arg checking for time.struct_time()Jerry Needell
2019-01-14Add subclass support to displayio.Scott Shawcroft
Also, swap make_news to accept a kwarg map and refine param checking. Fixes #1237
2018-11-18Remove reference to clock_id on the function descriptiionsCarlos
2018-11-18Fix time.monotonic_ns docstringCarlos
2018-10-21shared-bindings/time: introduce time.monotonic_nsJeff Epler
This is intended to be compatible with Python 3.7's time.monotonic_ns. The "actual resolution" is 1ms due to this being the unit at which common_hal_time_monotonic ticks. Closes #519
2018-08-25Fix os.stat() to use 1970 epochNoralf Trønnes
Commit 95e70cd0ea6d 'time: Use 1970 epoch' changed epoch for the time module, but not for other users. This patch does the same for the only other core timeutils user: extmod/vfs_fat.c:fat_vfs_stat(). Other timeutils users: cc3200, esp8266 and stm32, are not changed. Ports that don't use long ints, will still get wrong time values from os.stat().
2018-08-07Support internationalisation.Scott Shawcroft
2018-07-13compiles and runs; hangs on import storage;storage.VfsFat.<tab>Dan Halbert
2018-05-18time: Use 1970 epochNoralf Trønnes
Use UNIX epoch to match CPython. This overflows small int so time.{time,localtime,mktime} is only supported with long int. Also remove some comment cruft in time_time().
2018-04-16Add rtc moduleNoralf Trønnes
Add an rtc module that provides a singleton RTC class with - a datetime property to set and get time if the board supports it. - a calbration property to adjust the clock. There's also an rtc.set_time_source() method to override this RTC object using pure python. The time module gets 3 methods: - time.time() - time.localtime() - time.mktime() The rtc timesource is used to provide time to the time module. lib/timeutils is used for time conversions and thus only supports dates after 2000.
2017-10-23Merge 2.1.0 changes into master.Dan Halbert
2017-08-27Modernize module and class static dicts; update freetouchDan Halbert
2017-06-20Merge tag 'v1.9.1'2.0.0-alpha.0Scott Shawcroft
Fixes for stmhal USB mass storage, lwIP bindings and VFS regressions This release provides an important fix for the USB mass storage device in the stmhal port by implementing the SCSI SYNCHRONIZE_CACHE command, which is now require by some Operating Systems. There are also fixes for the lwIP bindings to improve non-blocking sockets and error codes. The VFS has some regressions fixed including the ability to statvfs the root. All changes are listed below. py core: - modbuiltins: add core-provided version of input() function - objstr: catch case of negative "maxsplit" arg to str.rsplit() - persistentcode: allow to compile with complex numbers disabled - objstr: allow to compile with obj-repr D, and unicode disabled - modsys: allow to compile with obj-repr D and PY_ATTRTUPLE disabled - provide mp_decode_uint_skip() to help reduce stack usage - makeqstrdefs.py: make script run correctly with Python 2.6 - objstringio: if created from immutable object, follow copy on write policy extmod: - modlwip: connect: for non-blocking mode, return EINPROGRESS - modlwip: fix error codes for duplicate calls to connect() - modlwip: accept: fix error code for non-blocking mode - vfs: allow to statvfs the root directory - vfs: allow "buffering" and "encoding" args to VFS's open() - modframebuf: fix signed/unsigned comparison pendantic warning lib: - libm: use isfinite instead of finitef, for C99 compatibility - utils/interrupt_char: remove support for KBD_EXCEPTION disabled tests: - basics/string_rsplit: add tests for negative "maxsplit" argument - float: convert "sys.exit()" to "raise SystemExit" - float/builtin_float_minmax: PEP8 fixes - basics: convert "sys.exit()" to "raise SystemExit" - convert remaining "sys.exit()" to "raise SystemExit" unix port: - convert to use core-provided version of built-in import() - Makefile: replace references to make with $(MAKE) windows port: - convert to use core-provided version of built-in import() qemu-arm port: - Makefile: adjust object-file lists to get correct dependencies - enable micropython.mem_*() functions to allow more tests stmhal port: - boards: enable DAC for NUCLEO_F767ZI board - add support for NUCLEO_F446RE board - pass USB handler as parameter to allow more than one USB handler - usb: use local USB handler variable in Start-of-Frame handler - usb: make state for USB device private to top-level USB driver - usbdev: for MSC implement SCSI SYNCHRONIZE_CACHE command - convert from using stmhal's input() to core provided version cc3200 port: - convert from using stmhal's input() to core provided version teensy port: - convert from using stmhal's input() to core provided version esp8266 port: - Makefile: replace references to make with $(MAKE) - Makefile: add clean-modules target - convert from using stmhal's input() to core provided version zephyr port: - modusocket: getaddrinfo: Fix mp_obj_len() usage - define MICROPY_PY_SYS_PLATFORM (to "zephyr") - machine_pin: use native Zephyr types for Zephyr API calls docs: - machine.Pin: remove out_value() method - machine.Pin: add on() and off() methods - esp8266: consistently replace Pin.high/low methods with .on/off - esp8266/quickref: polish Pin.on()/off() examples - network: move confusingly-named cc3200 Server class to its reference - uos: deconditionalize, remove minor port-specific details - uos: move cc3200 port legacy VFS mounting functions to its ref doc - machine: sort machine classes in logical order, not alphabetically - network: first step to describe standard network class interface examples: - embedding: use core-provided KeyboardInterrupt object
2017-06-07shared-bindings: Update docs to remove with statements from examples but add ↵Scott Shawcroft
more detail to the design guide about their use.
2017-03-07shared-bindings: Reenable struct_time. It was turned off when playing with ↵Scott Shawcroft
LTO and never re-enabled.
2017-02-26atmel-samd: Use link time optimization to reduce code size of builds whichScott Shawcroft
share space with the file system. "Express" builds with SPI flash crash the compiler for some reason so its currently disabled for them.
2017-02-24Make more type structures const to save RAM.Scott Shawcroft
2017-02-24Switch exception throwing to mp_raise helpers. It saves a little code space ↵Scott Shawcroft
each time to share the call.
2017-02-22Throw an error when sleep time is negative.Scott Shawcroft
2017-01-08Correct monotonic.Scott Shawcroft
Fixes #69.
2017-01-05Add time.struct_time support.Scott Shawcroft
2016-11-21This introduces an alternative hardware API called nativeio structured ↵Scott Shawcroft
around different functions that are typically accelerated by native hardware. Its not meant to reflect the structure of the hardware. Docs are here: http://tannewt-micropython.readthedocs.io/en/microcontroller/ It differs from upstream's machine in the following ways: * Python API is identical across ports due to code structure. (Lives in shared-bindings) * Focuses on abstracting common functionality (AnalogIn) and not representing structure (ADC). * Documentation lives with code making it easy to ensure they match. * Pin is split into references (board.D13 and microcontroller.pin.PA17) and functionality (DigitalInOut). * All nativeio classes claim underlying hardware resources when inited on construction, support Context Managers (aka with statements) and have deinit methods which release the claimed hardware. * All constructors take pin references rather than peripheral ids. Its up to the implementation to find hardware or throw and exception.