|
Home2L - Python API v1.4-2-g83f4c (2025-08-23)
Smart Tools for a Private Home
|
Date and time helpers.

Functions | |
| TicksNow () | |
| TicksToday () | |
| TicksOfDate (dy, dm, dd) | |
| TicksOfTime (th, tm, ts) | |
| TicksOfSeconds (*args) | |
| TicksOfMillis (ms) | |
| TicksAbsFromMonotic (tm) | |
| TicksMonotonicFromAbs (ta) | |
| _TicksAbsStr (ticks) | |
| _TicksRelStr (ticks) | |
| _TicksFromString (str, absolute) | |
| TicksAbsStr (ticks) | |
| TicksRelStr (ticks) | |
| TicksAbsOf (something) | |
| TicksRelOf (something) | |
| TicksToPyDateTime (t) | |
| TicksToPyTimeDelta (t) | |
| TicksFromUTC (t) | |
| TicksToUTC (t) | |
| TicksNow | ( | ) |
TicksNow() -> TTicks
Get the current time in units of 'TTicks' (milliseconds).
| TicksToday | ( | ) |
TicksToday() -> TTicks
Get the time 0:00 of the current day in units of 'TTicks' (milliseconds).
| TicksOfDate | ( | dy, | |
| dm, | |||
| dd | |||
| ) |
TicksOfDate(int dy, int dm, int dd) -> TTicks
Convert a date into 'TTicks' units (absolute).
| TicksOfTime | ( | th, | |
| tm, | |||
| ts | |||
| ) |
TicksOfTime(int th, int tm, int ts) -> TTicks
Convert a time into 'TTicks' units (relative).
The values returned by 'TicksOfDate' and 'TicksOfTime' as well as a
number of milliseconds can be simply added to obtain a 'TTicks' value
for a certain time at a certain date.
| TicksOfSeconds | ( | * | args | ) |
TicksOfSeconds(int secs) -> TTicks
TicksOfSeconds(float secs) -> TTicks
| TicksOfMillis | ( | ms | ) |
TicksOfMillis(int ms) -> TTicks
| TicksAbsFromMonotic | ( | tm | ) |
TicksAbsFromMonotic(TTicks tm) -> TTicks
| TicksMonotonicFromAbs | ( | ta | ) |
TicksMonotonicFromAbs(TTicks ta) -> TTicks
|
protected |
_TicksAbsStr(TTicks ticks) -> char const *
|
protected |
_TicksRelStr(TTicks ticks) -> char const *
|
protected |
_TicksFromString(char const * str, bool absolute) -> TTicks
| TicksAbsStr | ( | ticks | ) |
Return an absolute TTicks value as a string in Home2L format.
| TicksRelStr | ( | ticks | ) |
Return a relative TTicks value as a string in Home2L format.
| TicksAbsOf | ( | something | ) |
Magic wand to convert anything to an absolute TTicks value as intuitively as possible. The function is similar to TicksRelOf(), but it guarantees to return an absolute time. - Values of type string are interpreted as time specifications for TicksFromString() or as accepted by the Home2L Shell. The returned value is always an absolute time. - Numeral types (int, float) are interpreted relative to now if their value is below 10^11 (approx. 3 years). Otherwise, they are returned as they are. - Values of type 'datetime.date' or 'datetime.datetime' are interpreted as absolute times and returned. - Values of type 'datetime.time', are interpreted relative to today. Note: Be careful when calling this variant close to midnight. Functions triggered by the '/local/timer/daily' resource or the '@daily()' decorator are guaranteed to be called (shortly) after midnight and can thus safely use this variant. - For values of type 'datetime.timedelta', the time relative to now is returned.
| TicksRelOf | ( | something | ) |
Magic wand to convert anything to a relative 'TTicks' value as intuitively as possible. The function is similar to TicksAbsOf(), but it guarantees to return a relative time. - Values of type string are interpreted as time specifications for TicksFromString() or as accepted by the Home2L Shell. - Values of numeral types are returned as they are. - For values of type 'datetime.time', the relative time from the beginning of a day is returned. - For values of type 'datetime.timedelta', the relative delta time in milliseconds is returned. Note: Values of type 'datetime.date' or 'datetime.datetime' are not supported.
| TicksToPyDateTime | ( | t | ) |
Return a Python 'datetime.datetime' object for an absolute ticks value.
| TicksToPyTimeDelta | ( | t | ) |
Return a Python 'datetime.timedelta' object for a relative ticks value.
| TicksFromUTC | ( | t | ) |
Correct an absolute ticks value created from a UTC time string.
| TicksToUTC | ( | t | ) |
Convert an absolute ticks value to a value that will return UTC time when converted to a string.