| 23 | using namespace GammaRay; |
| 24 | |
| 25 | static qint64 appStartTime() |
| 26 | { |
| 27 | #ifdef Q_OS_LINUX |
| 28 | |
| 29 | // On Linux the application start time can be read by procfs. |
| 30 | const QString &self = QStringLiteral("/proc/%1").arg(qApp->applicationPid()); |
| 31 | return QFileInfo(self).lastModified().toMSecsSinceEpoch(); |
| 32 | |
| 33 | #else // !Q_OS_LINUX |
| 34 | |
| 35 | // On other platforms this is a rough estimation if called early. |
| 36 | return QDateTime::currentMSecsSinceEpoch(); |
| 37 | |
| 38 | #endif // !Q_OS_LINUX |
| 39 | } |
| 40 | |
| 41 | const RelativeClock *RelativeClock::sinceAppStart() |
| 42 | { |