eta.util.time.TimePoint

class TimePoint(time=None)[source]

Bases: object

A specific point in time.

Parameters:

time (datetime, tuple[datetime, datetime], list[str], or None) –

Initialize with a given datetime, or otherwise use the current time. The following formats are supported:

  • datetime : a single instantaneous timestamp.

  • (datetime, datetime) : lower and upper bound timestamps for this time point.

  • [$, date+time, <year>, <month>, <day>, <hour>, <minute>, <second>] : a date+time record structure, where each slot may be either a number string or a variable string.

  • None : the time point will be initialized to the current time.

lower

A timestamp for the lower bound on this timepoint.

Type:

datetime

upper

A timestamp for the upper bound on this timepoint.

Type:

datetime

Methods

copy

format

Format this TimePoint as a year/month/day/hour/minute/second representation.

format_date

Format this TimePoint as a human-readable year/month/day/hour/minute/second representation.

get_duration

to_num

Convert this TimePoint to a numerical POSIX representation (using the upper bound by default).

to_ulf

Convert this TimePoint to a ULF record structure.

update

Update this TimePoint to the given time (or current if none is given).

update(time=None)[source]

Update this TimePoint to the given time (or current if none is given).

to_num(bound='upper')[source]

Convert this TimePoint to a numerical POSIX representation (using the upper bound by default).

format()[source]

Format this TimePoint as a year/month/day/hour/minute/second representation.

format_date()[source]

Format this TimePoint as a human-readable year/month/day/hour/minute/second representation.

to_ulf()[source]

Convert this TimePoint to a ULF record structure.

__str__()[source]

Return str(self).