summaryrefslogtreecommitdiff
path: root/unix/modtime.c
AgeCommit message (Collapse)Author
2017-07-31all: Use the name MicroPython consistently in commentsAlexander Steffen
There were several different spellings of MicroPython present in comments, when there should be only one.
2017-06-11unix/modtime: Replace strftime() with localtime().Paul Sokolovsky
Baremetal ports standardized on providing localtime(). localtime() offers more functionality, in particular, strftime() can be completely implemented in Python with localtime().
2017-03-20unix: Use mp_handle_pending() in time.sleep().Damien George
2016-11-03windows: Implement mp_hal_ticks_cpu in terms of QueryPerformanceCounterstijn
2016-10-29extmod/utime_mphal: Implement ticks_add(), add to all maintained ports.Paul Sokolovsky
2016-10-29unix/modtime: Switch ticks/sleep_ms/us() to utime_mphal.Paul Sokolovsky
2016-10-29unix/modtime: Use ticks_diff() implementation from extmod/utime_mphal.c.Paul Sokolovsky
2016-09-22all: Remove 'name' member from mp_obj_module_t struct.Damien George
One can instead lookup __name__ in the modules dict to get the value.
2016-06-28unix/modtime: Release the GIL when sleeping.Damien George
2016-06-17unix: Move "utime" module config to C level instead of make level.Paul Sokolovsky
2016-01-11py: Change type signature of builtin funs that take variable or kw args.Damien George
With this patch the n_args parameter is changed type from mp_uint_t to size_t.
2016-01-10unix/modtime: strftime(): Support 2nd argument, but as time_t value.Paul Sokolovsky
Instead of struct tm like structure, as required by CPython.
2015-12-14unix/modtime: Add strftime() function (only single argument is supported).Paul Sokolovsky
Following "don't rely on FFI for basic functionality" approach.
2015-12-02unix/modtime: sleep(): Return early if KeyboardInterrupt is pendingPaul Sokolovsky
As set by signal handler. This assumes that exception will be raised somewhere else, which so far doesn't happen for single function call. Still, it makes sense to handle that in some common place.
2015-11-29py: Add MP_ROM_* macros and mp_rom_* types and use them.Damien George
2015-11-29unix/modtime: Unbreak Windows build after changes to check select() result.Paul Sokolovsky
2015-11-29unix/modtime: sleep(): Automatically restart after receiving EINTR.Paul Sokolovsky
THis is required to deal well with signals, signals being the closest analogue of hardware interrupts for POSIX. This is also CPython 3.5 compliant behavior (PEP 475). The main problem implementing this is to figure out how much time was spent in waiting so far/how much is remaining. It's well-known fact that Linux updates select()'s timeout value when returning with EINTR to the remaining wait time. Here's what POSIX-based standards say about this: (http://pubs.opengroup.org/onlinepubs/9699919799/functions/pselect.html): "Upon successful completion, the select() function may modify the object pointed to by the timeout argument." I.e. it allows to modify timeout value, but doesn't say how exactly it is modified. And actually, it allows such modification only "upon successful completion", which returning with EINTR error hardly is. POSIX also allows to request automatic EINTR restart for system calls using sigaction call with SA_RESTART flag, but here's what the same document says about it: "If SA_RESTART has been set for the interrupting signal, it is implementation-defined whether the function restarts or returns with [EINTR]." In other words, POSIX doesn't leave room for both portable and efficient handling of this matter, so the code just allows to manually select Linux-compatible behavior with MICROPY_SELECT_REMAINING_TIME option, or otherwise will just raise OSError. When systems with non-Linux behavior are found, they can be handled separately.
2015-10-19unix/modtime: Implement ticks_ms(), ticks_us() and ticks_diff().Paul Sokolovsky
All of these functions return positive small int, thus range is 2 bits less than word size (30 bit on 32-bit systems, 62 bit on 64-bit systems).
2015-10-19unix/modtime: Implement sleep_ms(), sleep_us().Paul Sokolovsky
2015-01-12py, unix, lib: Allow to compile with -Wold-style-definition.Damien George
2015-01-12py, unix: Allow to compile with -Wdouble-promotion.Damien George
Ref issue #699.
2015-01-01unix: Prefix includes with py/; remove need for -I../py.Damien George
2014-12-17unix: Rename "time" module to "utime" to allow extensibility.Paul Sokolovsky
Name choosen per latest conventions and for compatibiity with stmhal port.
2014-11-29Use MP_DEFINE_CONST_DICT macro to define module dicts.Damien George
This is just a clean-up of the code. Generated code is exactly the same.
2014-07-03Rename machine_(u)int_t to mp_(u)int_t.Damien George
See discussion in issue #50.
2014-06-28unix: Fix mpconfig.h not being included before misc.hstijn
This fixes count_lead_ones in misc.h not compiling due to unknown types
2014-06-19Prefix ARRAY_SIZE with micropython prefix MP_Emmanuel Blot
2014-06-07- Cast the struct stat sb.st_ino field to machine_int_t explicitly to avoid aMarcus von Appen
cast error in MP_OBJ_NEW_SMALL_INT(). This is necessary for FreeBSD, where st_ino is of different size - If MP_CLOCKS_PER_SEC is defined on the target host, simply define CLOCK_DIV as a fraction, regardless of the value of MP_CLOCKS_PER_SEC. FreeBSD uses a non-POSIX compliant value of 128 for CLOCKS_PER_SEC
2014-06-01Rename bultins config variables to MICROPY_PY_BUILTINS_*.Damien George
This renames: MICROPY_PY_FROZENSET -> MICROPY_PY_BUILTINS_FROZENSET MICROPY_PY_PROPERTY -> MICROPY_PY_BUILTINS_PROPERTY MICROPY_PY_SLICE -> MICROPY_PY_BUILTINS_SLICE MICROPY_ENABLE_FLOAT -> MICROPY_PY_BUILTINS_FLOAT See issue #35 for discussion.
2014-05-10mingw: Fix compilation issuesstijn
- use lowercase windows.h - fix for mingw32 using preprocessor-unfriendly definition of CLOCKS_PER_SEC
2014-05-09windows: Add modtime implementationstijn
2014-05-03Add license header to (almost) all files.Damien George
Blanket wide to all .c and .h files. Some files originating from ST are difficult to deal with (license wise) so it was left out of those. Also merged modpyb.h, modos.h, modstm.h and modtime.h in stmhal/.
2014-04-26Add ARRAY_SIZE macro, and use it where possible.Damien George
2014-04-17unix modtime: Convert to static module structures.Paul Sokolovsky
2014-04-17unix modtime: Adhere to MICROPY_ENABLE_FLOAT better.Paul Sokolovsky
2014-04-04unix: Rename module sources per latest naming conventions (mod*.c).Paul Sokolovsky