blob: 2befd0df545ce7ff38858685c7dc953dad6761cb [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 *
Pau Espin Pedrol21d03d32019-07-22 12:05:52 +02007 * SPDX-License-Identifier: AGPL-3.0+
8 *
kurtis.heimerl8aea56e2011-11-26 03:18:30 +00009 * This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU Affero General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Affero General Public License for more details.
18 *
19 * You should have received a copy of the GNU Affero General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 * See the COPYING file in the main directory for details.
22 */
23
24#include "radioClock.h"
25
26void RadioClock::set(const GSM::Time& wTime)
27{
Tom Tsoueb54bdd2014-11-25 16:06:32 -080028 ScopedLock lock(mLock);
kurtis.heimerl8aea56e2011-11-26 03:18:30 +000029 mClock = wTime;
30 updateSignal.signal();
kurtis.heimerl8aea56e2011-11-26 03:18:30 +000031}
32
33void RadioClock::incTN()
34{
Tom Tsoueb54bdd2014-11-25 16:06:32 -080035 ScopedLock lock(mLock);
kurtis.heimerl8aea56e2011-11-26 03:18:30 +000036 mClock.incTN();
37 updateSignal.signal();
kurtis.heimerl8aea56e2011-11-26 03:18:30 +000038}
39
40GSM::Time RadioClock::get()
41{
Tom Tsoueb54bdd2014-11-25 16:06:32 -080042 ScopedLock lock(mLock);
kurtis.heimerl8aea56e2011-11-26 03:18:30 +000043 GSM::Time retVal = mClock;
kurtis.heimerl8aea56e2011-11-26 03:18:30 +000044 return retVal;
45}
46
47void RadioClock::wait()
48{
Tom Tsoueb54bdd2014-11-25 16:06:32 -080049 ScopedLock lock(mLock);
kurtis.heimerl8aea56e2011-11-26 03:18:30 +000050 updateSignal.wait(mLock,1);
kurtis.heimerl8aea56e2011-11-26 03:18:30 +000051}