micropython-lib/python-stdlib/time
Matt Trentini 340243e205 time: Add README to explain the purpose of the time extension library.
Signed-off-by: Matt Trentini <matt.trentini@gmail.com>
2023-12-20 12:05:35 +11:00
..
README.md time: Add README to explain the purpose of the time extension library. 2023-12-20 12:05:35 +11:00
manifest.py all: Standardise x.y.z versioning for all packages. 2023-07-23 11:48:57 +10:00
test_time.py time: Add unit test for time.strftime. 2022-12-14 11:57:55 +11:00
time.py time: Add time module to provide strftime. 2022-12-14 11:57:12 +11:00

README.md

time

This library extends the built-in MicroPython time module to include time.strftime().

strftime() is omitted from the built-in time module to conserve space.

Installation

Use mip via mpremote:

> mpremote mip install time

See Package management for more details on using mip and mpremote.

Common uses

strftime() is used when using a loggging Formatter Object that employs asctime.

For example:

logging.Formatter('%(asctime)s | %(name)s | %(levelname)s - %(message)s')

The expected output might look like:

Tue Feb 17 09:42:58 2009 | MAIN | INFO - test

But if this time extension library isn't installed, asctime will always be None:

None | MAIN | INFO - test