ticks parameter must be a direct result of call Ticks before or after it, following modular-arithmetic definition of tick values Given a ticks value, this function allows to calculate ticks value delta Offset ticks value by a given number, which can be either positive or negative. Thisįunction is intended for very fine benchmarking or very tight real-time loops.Īvailability: Not every port implements this function. (resolution) of this function is not specified on time module level, butĭocumentation for a specific port may provide more specific information. high-resolution timer) can be used instead. But it doesn’t have to be a CPU clock, some other timing source available in a This is usually CPU clocks, and that’s why the function is named that Similar to ticks_ms() and ticks_us(), but with the highest possible resolution Just like ticks_ms() above, but in microseconds. Invalid results from the latter functions. Performing mathematical operations and then passing their resultsĪs arguments to ticks_diff() or ticks_add() will also lead to Operators (, >=) directly on these value will lead to invalid Note: Performing standard mathematical operations (+, -) or relational Ticks_diff() and ticks_add() functions described below. The only operations available for them are For the most part, you should treat values returnedīy these functions as opaque. TICKS_MAX], inclusive, total TICKS_PERIOD values. Thus, these functions will return a value in range [ 0. The same period value is usedįor all of ticks_ms(), ticks_us(), ticks_cpu() functions (for Two, but otherwise may differ from port to port. TICKS_PERIOD is guaranteed to be a power of Refer to it as TICKS_MAX to simplify discussion. The wrap-around value is not explicitly exposed, but we will Returns an increasing millisecond counter with an arbitrary reference point, that Microseconds, but it may take longer if the system has other higher priority This function attempts to provide an accurate delay of at least us sleep_us ( us ) ¶ĭelay for given number of microseconds, should be positive or 0. May take longer than that if other processing must take place, for example This function will delay for at least the given number of milliseconds, but sleep_ms ( ms ) ¶ĭelay for given number of milliseconds, should be positive or 0. Them use sleep_ms() and sleep_us() functions. Other boards may not accept a floating-point argument, for compatibility with Some boards may accept seconds as aįloating-point number to sleep for a fractional number of seconds. Year includes the century (for example 2014). The format of the entries in the 8-tuple are: The gmtime() function returns a date-time tuple in UTC, and localtime() returns a If secs is not provided or None, then the current time from the RTC is used. localtime ( ) ¶Ĭonvert the time secs expressed in seconds since the Epoch (see above) into anĨ-tuple which contains: (year, month, mday, hour, minute, second, weekday, yearday) If actual calendar time is not maintained with a system/MicroPython RTC,įunctions below which require reference to current absolute time mayīehave not as expected. RTC time across hard resets, though some may require setting it again Set manually by a user on each power-up (many boards then maintain Using networked time protocol (requires setup by a port/user). May be set using machine.RTC().datetime(tuple) function, and maintainedīy a backup battery (which may be an additional, optional component for System time depends on machine.RTC() object. Time is responsibility of OS/RTOS and is done outside of MicroPython, On systems with underlying OS (including some Maintaining actual calendar date/time: This requires a Epoch year may be determined with gmtime(0). However, some embedded ports use epoch of Time Epoch: Unix port uses standard for POSIX systems epoch of Measuring time intervals, and for delays. The time module provides functions for getting the current time and date, For more information, refer to the original This module implements a subset of the corresponding CPython module,Īs described below.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |