to compare latest logfile with the current running time of the script

how can i compare the latest log file with the current time..

consider i am running a script "a.sh" at 09:00
( function of the script a.sh is to update the database )
this script is going to create logfile if the script is sucess
in case of failure it is not going to create logfile..

my problem is if i start the script at 9:00
and the script fails .. it not going to create any entry in logfile
and during the verification the latest logfile in the log directary is
before 9.00 and verifcation(verification is carried out inside the a.sh script only after updating databse ) will say that .. it was sucessfully updated the
database(since it takes the latest log file ). but in this case it has taken a wrong logfile to verification..

i want to know that
when i run the script at 9.00 .. script should pick the logfile which as updated after 9.00 to verification and if the latest available log file is before 9.00 .. it should say it has failed..

PLEASE HELP me in this .. i want the solution urgent as my deadline is exceeding...