neotime.Time

The Time class is a nanosecond-precision drop-in replacement for the standard library time class. A high degree of API compatibility with the standard library classes is provided. This includes aliases for method names to allow, for example, Time.utc_now() to be called as Time.utcnow().

Time objects introduce the concept of ticks. This is simply a count of the number of seconds since midnight, in many ways analogous to the Date ordinal. Ticks values can be fractional, with a minimum value of 0 and a maximum of 86399.999999999.

Constructors and other class methods

class neotime.Time(hour, minute, second, tzinfo=None)
classmethod Time.now()
classmethod Time.utc_now()
classmethod Time.from_ticks(ticks)
classmethod Time.from_clock_time(t, epoch)

Class attributes

Time.min
Time.max
Time.resolution

Instance attributes

t.ticks
t.hour
t.minute
t.second
t.hour_minute_second
t.tzinfo

Operations

hash(t)
t1 == t2
t1 != t2
t1 < t2
t1 > t2
t1 <= t2
t1 >= t2
t1 + timedelta -> t2
t1 + duration -> t2
t1 - timedelta -> t2
t1 - duration -> t2
t1 - t2 -> timedelta

Instance methods

t.replace(hour=self.hour, minute=self.minute, second=self.second, tzinfo=self.tzinfo)

Return a Time with one or more components replaced with new values.

t.utc_offset()
t.dst()
t.tzname()
t.iso_format()
t.__repr__()
t.__str__()
t.__format__()

Special values

neotime.Midnight

A Time instance set to 00:00:00. This has a ticks value of 0.

neotime.Midday

A Time instance set to 12:00:00. This has a ticks value of 43200.