-
-
Notifications
You must be signed in to change notification settings - Fork 24
utime
The utime module provides functions for getting the current time and date, measuring time intervals, and for delays.
Time Epoch: This port uses standard for POSIX systems epoch of 1970-01-01 00:00:00 UTC.
Maintaining actual calendar date/time: K210 RTC peripheral is used for maintaining the actual date/time.
The date/time information is lost after power is removed.
Support for external RTC module is planned for some later time.
Convert a time expressed in seconds since the Epoch (see above) into an 8-tuple which contains: (year, month, mday, hour, minute, second, weekday, yearday).
If secs is not provided or None, then the current time from the RTC.
The time returnes is corrected to the local time zone.
- year includes the century (for example 2014).
- month is 1-12
- mday is 1-31
- hour is 0-23
- minute is 0-59
- second is 0-59
- weekday is 0-6 for Mon-Sun
- yearday is 1-366
Convert a time expressed in seconds since the Epoch (see above) into an 8-tuple which contains: (year, month, mday, hour, minute, second, weekday, yearday).
If secs is not provided or None, then the current time from the RTC.
The time returned is the UTC+0 time.
- year includes the century (for example 2014).
- month is 1-12
- mday is 1-31
- hour is 0-23
- minute is 0-59
- second is 0-59
- weekday is 0-6 for Mon-Sun
- yearday is 1-366
This is inverse function of gmtime/localtime. It’s argument is a full 8-tuple which expresses a time as per gmtime/localtime. It returns an integer which is the number of seconds since Epoch (Jan 1, 1970).
If the optional argument tz
is provides, the local time zone is set.
The tz
argument must be a time integer in the rangs -11
- +12
(relative to UTC).
If the optional argument setrtc
is True
, the system RTC time is set.
Convert a tuple time representing a time as returned by gmtime()
or localtime()
to a string as specified by the format
argument. If time
is not provided, the current RTC time is used.
format
must be a string. Standard Python time formating should be used
If local
argument is True
(default), local time is used, if False
gmtime is used.
Returns the number of seconds, as an integer, since the Epoch (Jan 1, 1970) from system RTC peripheral.
For the sleep time up to 2000 us the sleep functions are blocking.
For the sleep times greater than 2000 us, the functions do not block the execution of the other threads.
Sleeping can be interrupted if the thread executing it receives the notification.
Sleep for the given number of seconds.
Seconds provided as integer or a floating-point (sleep for a fractional number of seconds) are accepted.
Sleep for the given number of milli seconds.
Sleep for the given number of micro seconds.
Sleep for the given number of seconds.
Seconds provided as integer or a floating-point (sleep for a fractional number of seconds) are accepted.
Returns the actual sleep time. If the sleep was interrupted, it will be less than requested.
Sleep for the given number of milli seconds.
Returns the actual sleep time. If the sleep was interrupted, it will be less than requested.
Sleep for the given number of micro seconds.
Returns the actual sleep time. If the sleep was interrupted, it will be less than requested.
All
tick_*
functions uses 64-bit values and never overflows.
Performing standard mathematical operations (+, -) or relational operators (<, <=, >, >=) directly on returned values is allowed.
Returns the number of CPU clocks since the power was applied.
Returns the number micro seconds since the power was applied.
Returns the number of milli seconds since the power was applied.
Offset ticks value by a given number, which can be either positive or negative.
This function is provided for compatibility with other MicroPython ports.
As ticks values never overflows, performing standard mathematical operations (+, -) on ticks values is allowed.
Measure ticks difference between values returned from ticks_ms()
, ticks_us()
, or ticks_cpu()
.
This function is provided for compatibility with other MicroPython ports.
As ticks values never overflows, performing standard mathematical operations (+, -) on ticks values is allowed.
- Maix-M1 schematic
- Maix-Bit schematic
- Maix-Go schematic
- Kendryte K210 datasheet
- RISC-V ISA Design
- RISC-V ISA Manual
- Forum
- MicroPython documentation
If you find this project useful, you can contribute by making a donation