blob: 505bb01c6927b32368a91a3357745f330a4e8295 [file] [log] [blame]
kurtis.heimerl8aea56e2011-11-26 03:18:30 +00001/*
2 * Written by Thomas Tsou <ttsou@vt.edu>
3 * Based on code by Harvind S Samra <hssamra@kestrelsp.com>
4 *
5 * Copyright 2011 Free Software Foundation, Inc.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Affero General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Affero General Public License for more details.
16 *
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 * See the COPYING file in the main directory for details.
20 */
21
22#include "radioClock.h"
23
24void RadioClock::set(const GSM::Time& wTime)
25{
Tom Tsoueb54bdd2014-11-25 16:06:32 -080026 ScopedLock lock(mLock);
kurtis.heimerl8aea56e2011-11-26 03:18:30 +000027 mClock = wTime;
28 updateSignal.signal();
kurtis.heimerl8aea56e2011-11-26 03:18:30 +000029}
30
31void RadioClock::incTN()
32{
Tom Tsoueb54bdd2014-11-25 16:06:32 -080033 ScopedLock lock(mLock);
kurtis.heimerl8aea56e2011-11-26 03:18:30 +000034 mClock.incTN();
35 updateSignal.signal();
kurtis.heimerl8aea56e2011-11-26 03:18:30 +000036}
37
38GSM::Time RadioClock::get()
39{
Tom Tsoueb54bdd2014-11-25 16:06:32 -080040 ScopedLock lock(mLock);
kurtis.heimerl8aea56e2011-11-26 03:18:30 +000041 GSM::Time retVal = mClock;
kurtis.heimerl8aea56e2011-11-26 03:18:30 +000042 return retVal;
43}
44
45void RadioClock::wait()
46{
Tom Tsoueb54bdd2014-11-25 16:06:32 -080047 ScopedLock lock(mLock);
kurtis.heimerl8aea56e2011-11-26 03:18:30 +000048 updateSignal.wait(mLock,1);
kurtis.heimerl8aea56e2011-11-26 03:18:30 +000049}