#NEWLINE# def _get_start_shift( self , shift ) : #NEWLINE# #INDENT# if ( shift == '' ) : #NEWLINE# #INDENT# return 0 #NEWLINE# #UNINDENT# time_formats = [ '%Y-%m-%d %H:%M:%S' , '%Y-%m-%d %H:%M' , '%H:%M:%S' , '%H:%M' ] #NEWLINE# for time_format in time_formats : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# date = datetime . datetime . strptime ( shift , time_format ) #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# except TypeError : #NEWLINE# #INDENT# self . log . warning ( 'Start time must be string type ("%s"), ignored' , time_format [ 0 ] ) #NEWLINE# break #NEWLINE# #UNINDENT# today = datetime . date . today ( ) #NEWLINE# if ( today > date . date ( ) ) : #NEWLINE# #INDENT# date = datetime . datetime ( today . year , today . month , today . day , date . hour , date . minute , date . second ) #NEWLINE# #UNINDENT# return ( time . mktime ( date . timetuple ( ) ) - self . start_time ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . log . warning ( 'Unrecognized time format: %s ("%s" required), ignored' , shift , time_formats [ 0 ] ) #NEWLINE# #UNINDENT# return 0