Changeset 10936 for trunk


Ignore:
Timestamp:
06/08/11 20:14:26 (13 years ago)
Author:
tbretz
Message:
Decreased cpu usage for time display update.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/gui/MainWindow.cc

    r10917 r10936  
    8585void MainWindow::slot_TimeUpdate()
    8686{
    87     // Used toTUC to support also older Qt versions
    88     fUTC->setDateTime(QDateTime::currentDateTime().toUTC());
    89 }
     87    // Used toUTC to support also older Qt versions
     88    // toTime_t() always returns the datetime converted to UTC
     89    // dateTime() unfortunately returns our UTC always as LocalTime
     90    QDateTime now = QDateTime::currentDateTime().toUTC();
     91    now.setTimeSpec(Qt::LocalTime);
     92
     93    if (now.toTime_t()==fUTC->dateTime().toTime_t())
     94        return;
     95
     96    fUTC->setDateTime(now);
     97}
     98
    9099
    91100void MainWindow::SelectTab(const QString &name)
Note: See TracChangeset for help on using the changeset viewer.