MCPcopy Create free account
hub / github.com/PDAL/PDAL / leapSeconds

Function leapSeconds

plugins/mbio/io/MbReader.cpp:138–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

136{
137
138int leapSeconds(int y, int m)
139{
140 struct leap
141 {
142 int year;
143 int month;
144 };
145
146 const std::vector<leap> leaps
147 {
148 {1981, 7}, {1982, 7}, {1983, 7}, {1985, 7}, {1988, 1}, {1990, 1},
149 {1991, 1}, {1992, 7}, {1993, 7}, {1994, 7}, {1996, 1}, {1997, 1},
150 {1999, 1}, {2006, 1}, {2009, 1}, {2012, 7}, {2015, 7}, {2017, 1}
151 };
152
153 int secs = 0;
154 for (size_t i = 0; i < leaps.size(); ++i)
155 {
156 if (y > leaps[i].year)
157 secs++;
158 else if (y == leaps[i].year && m >= leaps[i].month)
159 {
160 secs++;
161 break;
162 }
163 else
164 break;
165 }
166 return secs;
167}
168
169// This is an attempt to convert mb_system's poorly defined time_i to
170// adjusted GPS standard time (GPS standard time offset by 1.0E9)

Callers 1

timeconvertFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected