PyShift Work Schedule
Work Schedule for Python
Static Public Member Functions | List of all members
shift_utils.ShiftUtils Class Reference

Utility methods. More...

Static Public Member Functions

int toEpochSecond (datetime instant)
 Get the second from the Epoch for this datetime. More...
 
int toEpochDay (date day)
 Get the day from the Epoch for this date. More...
 
str formatTimedelta (timedelta duration)
 Format a timedelta for display. More...
 
int toSecondOfDay (time dayTime)
 Get the second from the day for this time. More...
 
int toRoundedSecond (time dayTime)
 Get the second from the day for this time and round it. More...
 
int compare (time firstTime, time secondTime)
 Compare two times. More...
 

Detailed Description

Utility methods.

Member Function Documentation

◆ compare()

int shift_utils.ShiftUtils.compare ( time  firstTime,
time  secondTime 
)
static

Compare two times.

Parameters
firstTimeFirst time to compare
secondTimeSecond time to compare
Returns
-1 if less than, 0 if equal and 1 if greater than

◆ formatTimedelta()

str shift_utils.ShiftUtils.formatTimedelta ( timedelta  duration)
static

Format a timedelta for display.

Parameters
durationtimedelta
Returns
days : hours : minutes

◆ toEpochDay()

int shift_utils.ShiftUtils.toEpochDay ( date  day)
static

Get the day from the Epoch for this date.

Parameters
dayDate
Returns
days since Epoch

◆ toEpochSecond()

int shift_utils.ShiftUtils.toEpochSecond ( datetime  instant)
static

Get the second from the Epoch for this datetime.

Parameters
instantDate and time of day
Returns
seconds since Epoch

◆ toRoundedSecond()

int shift_utils.ShiftUtils.toRoundedSecond ( time  dayTime)
static

Get the second from the day for this time and round it.

Parameters
dayTimeTime of day
Returns
rounded seconds of day

◆ toSecondOfDay()

int shift_utils.ShiftUtils.toSecondOfDay ( time  dayTime)
static

Get the second from the day for this time.

Parameters
dayTimeTime of day
Returns
seconds of day

The documentation for this class was generated from the following file: