pylib.time_of_day module

Calculate time.

Date

2019-06-01

days(time)[source]

The days of the time (year).

Parameters

time (float or time.struct_time) – the time in seconds

Returns

hours, range [0, 365.2425]

Return type

float

days_norm(time)[source]

The days normalized to 365.2425 (Gregorian, on average) days.

Parameters

time (float or time.struct_time) – the time in seconds

Returns

the normalized days, range [0, 1]

Return type

float

hours(time)[source]

The hours of the time.

Parameters

time (float or time.struct_time) – the time in seconds

Returns

hours, range [0, 24]

Return type

float

hours_norm(time)[source]

The hours normalized to 24 hours.

Parameters

time (float or time.struct_time) – the time in seconds

Returns

the normalized hours, range [0, 1]

Return type

float

in_seconds(time)[source]

If time is time.struct_time convert to float seconds.

Parameters

time (float or time.struct_time) – the time in seconds

Returns

the time in seconds

Return type

float

minutes(time)[source]

The minutes of the time.

Parameters

time (float or time.struct_time) – the time in seconds

Returns

minutes, range [0, 60]

Return type

float

minutes_norm(time)[source]

The minutes normalized to 60 minutes.

Parameters

time (float or time.struct_time) – the time in seconds

Returns

the normalized minutes, range [0, 1]

Return type

float

seconds(time)[source]

The seconds of the time.

Parameters

time (float or time.struct_time) – the time in seconds

Returns

seconds, range [0, 60]

Return type

float

seconds_norm(time)[source]

The seconds normalized to 60 seconds.

Parameters

time (float or time.struct_time) – the time in seconds

Returns

the normalized seconds, range [0, 1]

Return type

float

transform(time_norm, length, offset=0)[source]

Transform normalized time value to new length.

Parameters
  • position_norm (float) – the normalized time value to transform

  • length (float) – the transformation

  • offset (float) – the offset (default = 0)

Returns

the transformation value

Return type

float