Skip to content

Commit

Permalink
Merge pull request #772 from Josverl/ref/mktime
Browse files Browse the repository at this point in the history
referecence-stubs/time : Use _Time8Tuple for all relevant time methods.
  • Loading branch information
Josverl authored Dec 30, 2024
2 parents 14b0aba + 121c81b commit 51d672c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions micropython-reference/time/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ _TicksMs: TypeAlias = int
_TicksUs: TypeAlias = int
_TicksCPU: TypeAlias = int
_Ticks = TypeVar("_Ticks", _TicksMs, _TicksUs, _TicksCPU, int)
_Time8Tuple: TypeAlias = Tuple[int, int, int, int, int, int, int, int]

def gmtime(secs: int | None = None, /) -> Tuple:
def gmtime(secs: int | None = None, /) -> _Time8Tuple:
"""
Convert the time *secs* expressed in seconds since the Epoch (see above) into an
8-tuple which contains: ``(year, month, mday, hour, minute, second, weekday, yearday)``
Expand All @@ -68,7 +69,7 @@ def gmtime(secs: int | None = None, /) -> Tuple:
"""
...

def localtime(secs: int | None = None, /) -> Tuple:
def localtime(secs: int | None = None, /) -> _Time8Tuple:
"""
Convert the time *secs* expressed in seconds since the Epoch (see above) into an
8-tuple which contains: ``(year, month, mday, hour, minute, second, weekday, yearday)``
Expand All @@ -90,7 +91,7 @@ def localtime(secs: int | None = None, /) -> Tuple:
"""
...

def mktime(local_time: tuple[int, int, int, int, int, int, int, int], /) -> int:
def mktime(local_time: _Time8Tuple, /) -> int:
"""
This is inverse function of localtime. It's argument is a full 8-tuple
which expresses a time as per localtime. It returns an integer which is
Expand Down

0 comments on commit 51d672c

Please sign in to comment.