Unity 8
 All Classes Functions Properties
TimeSource.cpp
1 /*
2  * Copyright (C) 2013 - Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser General Public License, as
6  * published by the Free Software Foundation; either version 2.1 or 3.0
7  * of the License.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranties of
11  * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
12  * PURPOSE. See the applicable version of the GNU Lesser General Public
13  * License for more details.
14  *
15  * You should have received a copy of both the GNU Lesser General Public
16  * License along with this program. If not, see <http://www.gnu.org/licenses/>
17  *
18  * Authored by: Daniel d'Andrada <daniel.dandrada@canonical.com>
19  */
20 
21 #include "TimeSource.h"
22 
23 #include <QElapsedTimer>
24 
25 namespace UbuntuGestures {
26 class RealTimeSourcePrivate {
27 public:
28  QElapsedTimer timer;
29 };
30 }
31 
32 using namespace UbuntuGestures;
33 
34 RealTimeSource::RealTimeSource()
35  : UbuntuGestures::TimeSource()
36  , d(new RealTimeSourcePrivate)
37 {
38  d->timer.start();
39 }
40 
41 RealTimeSource::~RealTimeSource()
42 {
43  delete d;
44 }
45 
46 qint64 RealTimeSource::msecsSinceReference()
47 {
48  return d->timer.elapsed();
49 }