simplify a nested function into a simple lambda and correct indentation
call the timetuple function in the tests
add some tests to cover cases which had not been tested