|
Telescience Resource Kit
TReK Python
5.4.0 ART
|
This class holds a time value represented as seconds from the system epoch. More...
Public Member Functions | |
Initialize / Finalize | |
Functions handling class initialization and finalization. | |
def | TrekTime ( Optional[TrekTime] trek_time=None, Optional[c_void_p] native_ptr=None -> def ) -> def |
Class initializer. More... | |
Get Time | |
Functions to return time. | |
def | __str__ ( -> str ) -> def |
Returns get_time_string(), fractional, not file friendly. | |
def | get_delta_time (delta_from: TrekTime -> float ) -> def |
Gets the difference between two times. More... | |
def | get_time ( -> tuple[int, int] ) -> def |
Gets the time relative the system epoch. More... | |
def | get_time_components ( -> TrekTimeComponents ) -> def |
Gets the complete time value in components. More... | |
def | get_time_float ( -> float ) -> def |
Gets time relative the system epoch as a 64-bit floating point. More... | |
def | get_time_string (fractional: bool=True, file_friendly: bool=False -> str ) -> def |
Gets the time as string. More... | |
def | get_iso_time_string ( -> str ) -> def |
Gets an ISO 8601 formatted time string. | |
def | get_seconds ( -> int ) -> def |
Returns the current number of seconds since the epoch. More... | |
def | get_subseconds ( -> int ) -> def |
Returns the current number of seconds since the epoch. More... | |
def | get_subseconds_per_second ( -> int ) -> def |
Returns the current number of subseconds per second. More... | |
Set Time | |
Functions to set time. | |
def | copy (copy_from: TrekTime -> None ) -> def |
Copies the content values of the provided 'copy_from' TrekTime into the callings' TrekTime. More... | |
def | shift_time (shift_amount: float -> None ) -> def |
Shifts the time. More... | |
def | set_time ( -> None ) -> def |
Sets the time to the current system time. More... | |
def | set_time_by_secs_subs (secs: int, subsecs: int=0 -> None ) -> def |
Sets the time relative the system epoch based on the input. More... | |
def | set_iso_time_by_string (timestr: str -> None ) -> def |
Sets the time with an ISO 8601 formatted time string. More... | |
def | set_time_by_string (timestr: str -> None ) -> def |
Sets the time based on the input string. More... | |
def | set_time_by_float (time_float: float -> None ) -> def |
Sets the time relative the system epoch based on the input. More... | |
def | set_subsec_per_second (subsecsper: int -> None ) -> def |
Set the number of subseconds per second. More... | |
This class holds a time value represented as seconds from the system epoch.
The time may also have an optional fractional second (subsecond) value. The number of subseconds allowed is enforced by the maximum subseconds per second value. The default number of subseconds per second is 1,000,000 (microseconds).
( | trek_time | : Optional[TrekTime] | |
native_ptr | : Optional[c_void_p] | ||
) | -> def |
( | copy_from | : TrekTime | ) | -> None |
( | delta_from | : TrekTime | ) | -> float |
Gets the difference between two times.
Calculates a 64-bit float point difference in seconds. Times are not required to have same subsecond resolution.
[in] | delta_from | TrekTime to delta with. |
( | ) | -> int |
Returns the current number of seconds since the epoch.
( | ) | -> int |
Returns the current number of seconds since the epoch.
( | ) | -> int |
Returns the current number of subseconds per second.
( | ) | -> tuple[int, int] |
Gets the time relative the system epoch.
( | ) | -> TrekTimeComponents |
Gets the complete time value in components.
( | ) | -> float |
Gets time relative the system epoch as a 64-bit floating point.
( | fractional | : bool | |
file_friendly | : bool | ||
) | -> str |
Gets the time as string.
[in] | fractional | Include subseconds. |
[in] | file_friendly | Uses '-' instead of ':' and '' for formatting. |
( | timestr | : str | ) | -> None |
Sets the time with an ISO 8601 formatted time string.
[in] | timestr | The ISO 8601 formatted time string (e.g. 2024-03-08T09:12:34.0123Z). |
TrekError | 15086 - TREK_DATA_TIME_LENGTH_ERROR, 15087 - TREK_DATA_TIME_STRING_FORMAT_ERROR, 15088 - TREK_DATA_TIME_TOO_SOON, 15089 - TREK_DATA_ILLEGAL_MONTH, 15090 - TREK_DATA_ILLEGAL_DAY, 15091 - TREK_DATA_ILLEGAL_HOURS, 15092 - TREK_DATA_ILLEGAL_MINUTES, 15093 - TREK_DATA_ILLEGAL_SECONDS |
( | subsecsper | : int | ) | -> None |
Set the number of subseconds per second.
Also resets the current subseconds to zero.
[in] | subsecsper | The number of subseconds per second. |
( | ) | -> None |
Sets the time to the current system time.
If the subseconds per second are allowed (see set_subsec_per_second), fractional seconds will be set as well.
( | time_float | : float | ) | -> None |
Sets the time relative the system epoch based on the input.
[in] | time_float | The new time in seconds from a 64-bit floating point. |
TrekError | 15085 - TREK_DATA_NEG_TIME_NOT_ALLOWED |
( | secs | : int | |
subsecs | : int | ||
) | -> None |
Sets the time relative the system epoch based on the input.
[in] | secs | The new seconds (>=0) since the epoch. |
[in] | subsecs | The new subseconds (>=0) of seconds. |
TrekError | 15084 - TREK_DATA_FRACTIONAL_TIME_VALUE_ERROR |
( | timestr | : str | ) | -> None |
Sets the time based on the input string.
The format of the string is:
YYYY-MM-DD hh:mm:ss(.fffff)
[in] | timestr | The new time. |
TrekError | 15086 - TREK_DATA_TIME_LENGTH_ERROR, 15087 - TREK_DATA_TIME_STRING_FORMAT_ERROR, 15088 - TREK_DATA_TIME_TOO_SOON, 15089 - TREK_DATA_ILLEGAL_MONTH, 15090 - TREK_DATA_ILLEGAL_DAY, 15091 - TREK_DATA_ILLEGAL_HOURS, 15092 - TREK_DATA_ILLEGAL_MINUTES, 15093 - TREK_DATA_ILLEGAL_SECONDS |
( | shift_amount | : float | ) | -> None |
Shifts the time.
Adds the input time to the current value stored in class.
[in] | shift_amount | Time in seconds to shift. |
TrekError | 15085 - TREK_DATA_NEG_TIME_NOT_ALLOWED |