Main Page
Related Pages
API Reference
Namespace List
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Variables
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
g
i
n
o
p
r
s
t
v
w
x
z
Enumerations
a
b
c
d
e
f
g
i
l
m
n
o
p
r
s
t
w
x
Enumerator
a
b
c
d
e
f
g
h
i
l
m
n
p
r
s
t
u
v
w
x
y
z
Class List
Class List
Class Hierarchy
Class Members
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
i
k
l
m
n
o
p
r
s
t
v
z
Enumerations
b
c
e
f
g
h
k
o
p
r
s
t
v
Enumerator
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
y
z
Related Functions
:
c
d
e
f
g
i
l
m
n
o
p
r
s
t
u
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
x
y
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
Variables
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
x
y
Typedefs
Enumerations
Enumerator
Macros
_
a
c
d
f
g
h
i
l
m
n
o
p
r
s
t
v
x
Examples
core
tests
TimeHandling
TimeCorrection_T.cpp
Go to the documentation of this file.
1
//==============================================================================
2
//
3
// This file is part of GNSSTk, the ARL:UT GNSS Toolkit.
4
//
5
// The GNSSTk is free software; you can redistribute it and/or modify
6
// it under the terms of the GNU Lesser General Public License as published
7
// by the Free Software Foundation; either version 3.0 of the License, or
8
// any later version.
9
//
10
// The GNSSTk is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
// GNU Lesser General Public License for more details.
14
//
15
// You should have received a copy of the GNU Lesser General Public
16
// License along with GNSSTk; if not, write to the Free Software Foundation,
17
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18
//
19
// This software was developed by Applied Research Laboratories at the
20
// University of Texas at Austin.
21
// Copyright 2004-2022, The Board of Regents of The University of Texas System
22
//
23
//==============================================================================
24
25
//==============================================================================
26
//
27
// This software was developed by Applied Research Laboratories at the
28
// University of Texas at Austin, under contract to an agency or agencies
29
// within the U.S. Department of Defense. The U.S. Government retains all
30
// rights to use, duplicate, distribute, disclose, or release this software.
31
//
32
// Pursuant to DoD Directive 523024
33
//
34
// DISTRIBUTION STATEMENT A: This software has been approved for public
35
// release, distribution is unlimited.
36
//
37
//==============================================================================
38
39
#include "
TimeCorrection.hpp
"
40
#include "
GPSWeekZcount.hpp
"
41
#include "
SystemTime.hpp
"
42
#include "
TestUtil.hpp
"
43
44
using namespace
std
;
45
using namespace
gnsstk
;
46
47
class
TimeCorrection_T
48
{
49
public
:
50
unsigned
testEpochRollover();
51
};
52
53
54
unsigned
TimeCorrection_T :: testEpochRollover
()
55
{
56
TUDEF
(
"TestCorrection"
,
"timeAdjustWeekRollover"
);
57
long
refWeek = 123;
58
// week year week year
59
// 123 = 1982 635 = 1992
60
// 1147 = 2001 1659 = 2011
61
// 2171 = 2021 2683 = 2031
62
// 3195 = 2041
63
// test same week with 10-bit weeks
64
TUASSERTE
(
long
, 123,
timeAdjustWeekRollover
(123, refWeek));
65
TUASSERTE
(
long
, 123, refWeek);
66
refWeek = 128;
67
// test slightly different week with 10-bit weeks
68
TUASSERTE
(
long
, 123,
timeAdjustWeekRollover
(123, refWeek));
69
TUASSERTE
(
long
, 128, refWeek);
70
// test 10-bit week edge cases
71
refWeek = 123 + 512;
72
TUASSERTE
(
long
, 123,
timeAdjustWeekRollover
(123, refWeek));
73
TUASSERTE
(
long
, 123 + 512, refWeek);
74
refWeek++;
75
TUASSERTE
(
long
, 1147,
timeAdjustWeekRollover
(123, refWeek));
76
TUASSERTE
(
long
, 123 + 513, refWeek);
77
// test 10-bit to-correct and full ref week
78
refWeek = 2014;
79
TUASSERTE
(
long
, 2014,
timeAdjustWeekRollover
(990, refWeek));
80
TUASSERTE
(
long
, 2014, refWeek);
81
// test 10-bit to-correct and full ref week, two epochs off
82
refWeek = 3038;
83
TUASSERTE
(
long
, 3038,
timeAdjustWeekRollover
(990, refWeek));
84
TUASSERTE
(
long
, 3038, refWeek);
85
// test full to-correct week and full ref week, one epoch off
86
refWeek = 3038;
87
TUASSERTE
(
long
, 3038,
timeAdjustWeekRollover
(2014, refWeek));
88
TUASSERTE
(
long
, 3038, refWeek);
89
// test future data
90
refWeek = 2014;
91
TUASSERTE
(
long
, 2015,
timeAdjustWeekRollover
(2015, refWeek));
92
TUASSERTE
(
long
, 2014, refWeek);
93
// test future data edge cases
94
refWeek = 2014;
95
TUASSERTE
(
long
, refWeek + 512,
timeAdjustWeekRollover
(refWeek + 512, refWeek));
96
TUASSERTE
(
long
, 2014, refWeek);
97
TUASSERTE
(
long
, refWeek - 511,
timeAdjustWeekRollover
(refWeek + 513, refWeek));
98
TUASSERTE
(
long
, 2014, refWeek);
99
// test real-time path
100
refWeek = 0;
101
GPSWeekZcount
cwz =
SystemTime
().
convertToCommonTime
();
102
long
expected = 1659;
103
// This code should be able to function as expected at least through 2031.
104
if
(cwz.
week
> 2683)
105
expected = 3195;
106
else
if
(cwz.
week
> 1659)
107
expected = 2171;
108
TUASSERTE
(
long
, expected,
timeAdjustWeekRollover
(123, refWeek));
109
// refWeek should have been set to the system clock's time's week
110
TUASSERTE
(
long
, cwz.
week
, refWeek);
111
TURETURN
();
112
}
113
114
115
int
main
()
116
{
117
TimeCorrection_T
testClass;
118
unsigned
errorTotal = 0;
119
errorTotal += testClass.
testEpochRollover
();
120
cout <<
"Total Errors for "
<< __FILE__ <<
": "
<< errorTotal << endl;
121
return
errorTotal;
122
}
GPSWeekZcount.hpp
TimeCorrection_T
Definition:
TimeCorrection_T.cpp:47
TUASSERTE
#define TUASSERTE(TYPE, EXP, GOT)
Definition:
TestUtil.hpp:81
gnsstk::UnixTime::convertToCommonTime
virtual CommonTime convertToCommonTime() const
Definition:
UnixTime.cpp:54
gnsstk
For Sinex::InputHistory.
Definition:
BasicFramework.cpp:50
gnsstk::GPSWeek::week
int week
Definition:
GPSWeek.hpp:271
TestUtil.hpp
TURETURN
#define TURETURN()
Definition:
TestUtil.hpp:232
SystemTime.hpp
gnsstk::timeAdjustWeekRollover
long timeAdjustWeekRollover(long toCorrectWeek, long &refWeek)
Definition:
TimeCorrection.cpp:46
TimeCorrection_T::testEpochRollover
unsigned testEpochRollover()
Definition:
TimeCorrection_T.cpp:54
gnsstk::SystemTime
Definition:
SystemTime.hpp:54
TUDEF
#define TUDEF(CLASS, METHOD)
Definition:
TestUtil.hpp:56
gnsstk::GPSWeekZcount
Definition:
GPSWeekZcount.hpp:55
std
Definition:
Angle.hpp:142
TimeCorrection.hpp
main
int main()
Definition:
TimeCorrection_T.cpp:115
gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:42