I have this code:

Qt Code:
  1. QTimer *timer=new QTimer;
  2. connect(timer, SIGNAL(timeout()),this,SLOT(delete_old_tuples()));
  3. timer->start(3600000);
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. void MainWindow::delete_old_tuples(){
  2. QDateTime now = QDateTime::currentDateTime();
  3. QDateTime timeoftheaction (QDate (now.date()), QTime (15,0,0));
  4. if (now >= timeoftheaction){
  5. QMessageBox::critical(0, qApp->tr("Deleting tuples"),
  6. qApp->tr("Click Cancel to exit."), QMessageBox::Cancel);
  7. }
  8. }
To copy to clipboard, switch view to plain text mode 

Is this code correct? I want to delete the tuples of my database everyday at 15:00....Is there a better way?