gnss-js 0.1.2 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +23 -0
- package/README.md +171 -5
- package/dist/analysis.cjs +1381 -0
- package/dist/analysis.d.cts +211 -0
- package/dist/analysis.d.ts +211 -0
- package/dist/analysis.js +14 -0
- package/dist/antex.cjs +239 -0
- package/dist/antex.d.cts +77 -0
- package/dist/antex.d.ts +77 -0
- package/dist/antex.js +8 -0
- package/dist/chunk-354IRDOG.js +239 -0
- package/dist/chunk-37QNKGTC.js +65 -0
- package/dist/chunk-5CMSYIYM.js +214 -0
- package/dist/chunk-5S5MONFK.js +0 -0
- package/dist/chunk-6FAL6P4G.js +12 -0
- package/dist/chunk-7NOFXKET.js +433 -0
- package/dist/chunk-CB6EOOLA.js +753 -0
- package/dist/chunk-HKN3PUGN.js +800 -0
- package/dist/chunk-IS4UUDBV.js +577 -0
- package/dist/chunk-K7WZQFBV.js +236 -0
- package/dist/chunk-LEEU5OIO.js +75 -0
- package/dist/chunk-PRSZIWKM.js +1482 -0
- package/dist/chunk-SDRRAJT5.js +433 -0
- package/dist/chunk-WR7LCB52.js +143 -0
- package/dist/chunk-Y3R57B5P.js +473 -0
- package/dist/chunk-YDMYO3YK.js +220 -0
- package/dist/constants.cjs +394 -0
- package/dist/constants.d.cts +14 -0
- package/dist/constants.d.ts +14 -0
- package/dist/constants.js +103 -0
- package/dist/coordinates.cjs +334 -0
- package/dist/coordinates.d.cts +81 -0
- package/dist/coordinates.d.ts +81 -0
- package/dist/coordinates.js +39 -0
- package/dist/ecef-CF0uAysr.d.cts +40 -0
- package/dist/ecef-CF0uAysr.d.ts +40 -0
- package/dist/ephemeris-BUWzfmBy.d.cts +114 -0
- package/dist/ephemeris-BUWzfmBy.d.ts +114 -0
- package/dist/gnss-BT6ulR17.d.cts +56 -0
- package/dist/gnss-C-tgoYNa.d.ts +56 -0
- package/dist/index.cjs +5774 -78
- package/dist/index.d.cts +17 -96
- package/dist/index.d.ts +17 -96
- package/dist/index.js +352 -415
- package/dist/nav-BAI1a9vK.d.cts +108 -0
- package/dist/nav-BAI1a9vK.d.ts +108 -0
- package/dist/nmea.cjs +247 -0
- package/dist/nmea.d.cts +37 -0
- package/dist/nmea.d.ts +37 -0
- package/dist/nmea.js +12 -0
- package/dist/ntrip.cjs +169 -0
- package/dist/ntrip.d.cts +98 -0
- package/dist/ntrip.d.ts +98 -0
- package/dist/ntrip.js +10 -0
- package/dist/orbit.cjs +504 -0
- package/dist/orbit.d.cts +117 -0
- package/dist/orbit.d.ts +117 -0
- package/dist/orbit.js +29 -0
- package/dist/parser-JPjjFgeP.d.cts +73 -0
- package/dist/parser-JPjjFgeP.d.ts +73 -0
- package/dist/rinex.cjs +1375 -0
- package/dist/rinex.d.cts +116 -0
- package/dist/rinex.d.ts +116 -0
- package/dist/rinex.js +37 -0
- package/dist/rtcm3.cjs +1519 -0
- package/dist/rtcm3.d.cts +143 -0
- package/dist/rtcm3.d.ts +143 -0
- package/dist/rtcm3.js +31 -0
- package/dist/signals.cjs +858 -0
- package/dist/signals.d.cts +93 -0
- package/dist/signals.d.ts +93 -0
- package/dist/signals.js +70 -0
- package/dist/time-DnI1VpE8.d.cts +33 -0
- package/dist/time-DnI1VpE8.d.ts +33 -0
- package/dist/time.cjs +585 -0
- package/dist/time.d.cts +307 -0
- package/dist/time.d.ts +307 -0
- package/dist/time.js +154 -0
- package/package.json +112 -14
- package/.prettierrc +0 -5
- package/jest.config.ts +0 -9
- package/test/functions.test.ts +0 -63
- package/test/gnss-scales.test.ts +0 -95
- package/test/julian.test.ts +0 -145
- package/test/rinex.test.ts +0 -11
- package/test/test.ts +0 -10
- package/test/utc.test.ts +0 -25
package/dist/time.d.cts
ADDED
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
import { H as HourCode, T as TimeDifference } from './time-DnI1VpE8.cjs';
|
|
2
|
+
export { D as DAYS_MJD2000_MJD, a as DAYS_MJD_JULIAN, M as MILLISECONDS_GPS_TAI, b as MILLISECONDS_IN_DAY, c as MILLISECONDS_IN_HOUR, d as MILLISECONDS_IN_MINUTE, e as MILLISECONDS_IN_SECOND, f as MILLISECONDS_IN_WEEK, g as MILLISECONDS_TT_TAI, R as RINEX_CODES, S as SECONDS_IN_DAY, h as SECONDS_IN_HOUR, i as SECONDS_IN_MINUTE, j as SECONDS_IN_WEEK, k as START_BDS_TIME, l as START_GAL_TIME, m as START_GLO_LEAP, n as START_GPS_TIME, o as START_JULIAN_TAI, p as START_MJD_UNIX_SECONDS, q as START_NTP_TIME, r as START_TAI_TIME, s as START_UNIX_TIME } from './time-DnI1VpE8.cjs';
|
|
3
|
+
|
|
4
|
+
declare enum Scale {
|
|
5
|
+
TAI = 0,
|
|
6
|
+
TT = 1,
|
|
7
|
+
GPS = 2,
|
|
8
|
+
UTC = 3
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** Returns milliseconds elapsed since the start of the UTC day. */
|
|
12
|
+
declare function getTimeOfDay(date: Date): number;
|
|
13
|
+
/** Reconstruct a Date from time-of-day in milliseconds and a reference date. */
|
|
14
|
+
declare function getDateFromTimeOfDay(timeOfDay: number, dateRaw: Date): Date;
|
|
15
|
+
/**
|
|
16
|
+
* Returns the day-of-year (1-366) for a given date.
|
|
17
|
+
* @param date - Date in GPS time scale
|
|
18
|
+
* @returns Day-of-year number (1-based)
|
|
19
|
+
*/
|
|
20
|
+
declare function getDayOfYear(date: Date): number;
|
|
21
|
+
/**
|
|
22
|
+
* Reconstructs a Date from a day-of-year and a reference date (preserves time-of-day).
|
|
23
|
+
* @param dayOfYear - Day-of-year number (1-based)
|
|
24
|
+
* @param date - Reference date in GPS time scale (year and time-of-day are used)
|
|
25
|
+
* @returns Date in GPS time scale
|
|
26
|
+
*/
|
|
27
|
+
declare function getDateFromDayOfYear(dayOfYear: number, date: Date): Date;
|
|
28
|
+
/**
|
|
29
|
+
* Returns the UTC day of the week (0 = Sunday, 6 = Saturday).
|
|
30
|
+
* @param date - Date in GPS time scale
|
|
31
|
+
* @returns Day of week (0-6)
|
|
32
|
+
*/
|
|
33
|
+
declare function getDayOfWeek(date: Date): number;
|
|
34
|
+
/**
|
|
35
|
+
* Reconstructs a Date by shifting a reference date to the given day of the week.
|
|
36
|
+
* @param dayOfWeek - Day of week (0 = Sunday, 6 = Saturday)
|
|
37
|
+
* @param dateRaw - Reference date in GPS time scale
|
|
38
|
+
* @returns Date in GPS time scale
|
|
39
|
+
*/
|
|
40
|
+
declare function getDateFromDayOfWeek(dayOfWeek: number, dateRaw: Date): Date;
|
|
41
|
+
/**
|
|
42
|
+
* Reconstructs a Date by setting the hour from a RINEX hour code ('a'-'x').
|
|
43
|
+
* @param hourCode - RINEX hour code letter ('a' = 00h, 'x' = 23h)
|
|
44
|
+
* @param date - Reference date in GPS time scale
|
|
45
|
+
* @returns Date in GPS time scale with the specified hour
|
|
46
|
+
*/
|
|
47
|
+
declare function getDateFromHourCode(hourCode: HourCode, date: Date): Date;
|
|
48
|
+
/**
|
|
49
|
+
* Returns the RINEX hour code ('a'-'x') for a given date.
|
|
50
|
+
* @param date - Date in GPS time scale
|
|
51
|
+
* @returns RINEX hour code letter ('a' = 00h, 'x' = 23h)
|
|
52
|
+
*/
|
|
53
|
+
declare function getHourCode(date: Date): HourCode;
|
|
54
|
+
/**
|
|
55
|
+
* Returns the ISO 8601 week number of the year (1-53).
|
|
56
|
+
* @param date - Date in GPS time scale
|
|
57
|
+
* @returns ISO week number
|
|
58
|
+
*/
|
|
59
|
+
declare function getWeekOfYear(date: Date): number;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Returns GPS time elapsed since the GPS epoch (6 Jan 1980) in milliseconds.
|
|
63
|
+
* @param date - Date in GPS time scale
|
|
64
|
+
* @returns GPS time in milliseconds
|
|
65
|
+
*/
|
|
66
|
+
declare function getGpsTime(date: Date): number;
|
|
67
|
+
/**
|
|
68
|
+
* Converts GPS time to a Date.
|
|
69
|
+
* @param gpsTime - GPS time in milliseconds since GPS epoch
|
|
70
|
+
* @returns Date in GPS time scale
|
|
71
|
+
*/
|
|
72
|
+
declare function getDateFromGpsTime(gpsTime: number): Date;
|
|
73
|
+
/**
|
|
74
|
+
* Returns Galileo time elapsed since the Galileo epoch in milliseconds.
|
|
75
|
+
* @param date - Date in GPS time scale
|
|
76
|
+
* @returns Galileo time in milliseconds
|
|
77
|
+
*/
|
|
78
|
+
declare function getGalTime(date: Date): number;
|
|
79
|
+
/**
|
|
80
|
+
* Converts Galileo time to a Date.
|
|
81
|
+
* @param galTime - Galileo time in milliseconds since Galileo epoch
|
|
82
|
+
* @returns Date in GPS time scale
|
|
83
|
+
*/
|
|
84
|
+
declare function getDateFromGalTime(galTime: number): Date;
|
|
85
|
+
/**
|
|
86
|
+
* Returns BeiDou time elapsed since the BDS epoch in milliseconds.
|
|
87
|
+
* @param date - Date in GPS time scale
|
|
88
|
+
* @returns BeiDou time in milliseconds
|
|
89
|
+
*/
|
|
90
|
+
declare function getBdsTime(date: Date): number;
|
|
91
|
+
/**
|
|
92
|
+
* Converts BeiDou time to a Date.
|
|
93
|
+
* @param bdsTime - BeiDou time in milliseconds since BDS epoch
|
|
94
|
+
* @returns Date in GPS time scale
|
|
95
|
+
*/
|
|
96
|
+
declare function getDateFromBdsTime(bdsTime: number): Date;
|
|
97
|
+
/**
|
|
98
|
+
* Converts a GPS-scale date to Unix time in milliseconds (applies leap seconds).
|
|
99
|
+
* @param date - Date in GPS time scale
|
|
100
|
+
* @returns Unix time in milliseconds
|
|
101
|
+
*/
|
|
102
|
+
declare function getUnixTime(date: Date): number;
|
|
103
|
+
/**
|
|
104
|
+
* Converts Unix time to a GPS-scale Date (applies leap seconds).
|
|
105
|
+
* @param unixTime - Unix time in milliseconds
|
|
106
|
+
* @returns Date in GPS time scale
|
|
107
|
+
*/
|
|
108
|
+
declare function getDateFromUnixTime(unixTime: number): Date;
|
|
109
|
+
/**
|
|
110
|
+
* Returns the GPS week number.
|
|
111
|
+
* @param date - Date in GPS time scale
|
|
112
|
+
* @returns GPS week number (continuous, not rolled over)
|
|
113
|
+
*/
|
|
114
|
+
declare function getWeekNumber(date: Date): number;
|
|
115
|
+
/** Returns GPS time-of-week in milliseconds. */
|
|
116
|
+
declare function getTimeOfWeek(date: Date): number;
|
|
117
|
+
/** Reconstruct a Date from GPS week number and time-of-week in milliseconds. */
|
|
118
|
+
declare function getDateFromGpsData(weekNumber: number, timeOfWeek: number): Date;
|
|
119
|
+
/**
|
|
120
|
+
* Converts a GPS-scale Date to TAI scale.
|
|
121
|
+
* @param date - Date in GPS time scale
|
|
122
|
+
* @returns Date in TAI time scale
|
|
123
|
+
*/
|
|
124
|
+
declare function getTaiDate(date: Date): Date;
|
|
125
|
+
/**
|
|
126
|
+
* Converts a TAI-scale Date to GPS scale.
|
|
127
|
+
* @param tai_date - Date in TAI time scale
|
|
128
|
+
* @returns Date in GPS time scale
|
|
129
|
+
*/
|
|
130
|
+
declare function getDateFromTai(tai_date: Date): Date;
|
|
131
|
+
/**
|
|
132
|
+
* Converts a GPS-scale Date to TT (Terrestrial Time) scale.
|
|
133
|
+
* @param date - Date in GPS time scale
|
|
134
|
+
* @returns Date in TT time scale
|
|
135
|
+
*/
|
|
136
|
+
declare function getTtDate(date: Date): Date;
|
|
137
|
+
/**
|
|
138
|
+
* Converts a TT-scale Date to GPS scale.
|
|
139
|
+
* @param tt_date - Date in TT time scale
|
|
140
|
+
* @returns Date in GPS time scale
|
|
141
|
+
*/
|
|
142
|
+
declare function getDateFromTt(tt_date: Date): Date;
|
|
143
|
+
/**
|
|
144
|
+
* Returns the GLONASS four-year interval number (N4) since 1996.
|
|
145
|
+
* @param date - Date in GPS time scale
|
|
146
|
+
* @returns GLONASS N4 period number (0-based)
|
|
147
|
+
*/
|
|
148
|
+
declare function getGloN4(date: Date): number;
|
|
149
|
+
/**
|
|
150
|
+
* Returns the GLONASS day number (NA) within the current four-year interval.
|
|
151
|
+
* @param date - Date in GPS time scale
|
|
152
|
+
* @returns Day number within the N4 period (1-based)
|
|
153
|
+
*/
|
|
154
|
+
declare function getGloNA(date: Date): number;
|
|
155
|
+
/** Reconstruct a Date from GLONASS N4 (4-year period), NA (day number), and time-of-day in milliseconds. */
|
|
156
|
+
declare function getDateFromGloN(n4: number, na: number, tod: number): Date;
|
|
157
|
+
/**
|
|
158
|
+
* Converts a GPS-scale Date to NTP time in milliseconds since the NTP epoch.
|
|
159
|
+
* @param date - Date in GPS time scale
|
|
160
|
+
* @returns NTP time in milliseconds
|
|
161
|
+
*/
|
|
162
|
+
declare function getNtpTime(date: Date): number;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Formats a Date as a RINEX epoch string (e.g. "> 2024 01 15 12 00 00.0000000").
|
|
166
|
+
* @param date - Date in GPS time scale
|
|
167
|
+
* @returns RINEX-formatted epoch string
|
|
168
|
+
*/
|
|
169
|
+
declare function getRINEX(date: Date): string;
|
|
170
|
+
/**
|
|
171
|
+
* Parses a RINEX epoch string into a Date.
|
|
172
|
+
* @param rinex - RINEX-formatted epoch string
|
|
173
|
+
* @returns Date in GPS time scale
|
|
174
|
+
*/
|
|
175
|
+
declare function getDateFromRINEX(rinex: string): Date;
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Returns the time difference between two dates in milliseconds.
|
|
179
|
+
* @param startDate - Start date
|
|
180
|
+
* @param finalDate - End date
|
|
181
|
+
* @returns Difference (finalDate - startDate) in milliseconds
|
|
182
|
+
*/
|
|
183
|
+
declare function getTimeDifference(startDate: Date, finalDate: Date): number;
|
|
184
|
+
/**
|
|
185
|
+
* Extracts the seconds component (0-59) from a time difference.
|
|
186
|
+
* @param timeDifference - Time difference in milliseconds
|
|
187
|
+
* @returns Seconds component (0-59)
|
|
188
|
+
*/
|
|
189
|
+
declare function getSecondsFromTimeDifference(timeDifference: number): number;
|
|
190
|
+
/**
|
|
191
|
+
* Extracts the minutes component (0-59) from a time difference.
|
|
192
|
+
* @param timeDifference - Time difference in milliseconds
|
|
193
|
+
* @returns Minutes component (0-59)
|
|
194
|
+
*/
|
|
195
|
+
declare function getMinutesFromTimeDifference(timeDifference: number): number;
|
|
196
|
+
/**
|
|
197
|
+
* Extracts the hours component (0-23) from a time difference.
|
|
198
|
+
* @param timeDifference - Time difference in milliseconds
|
|
199
|
+
* @returns Hours component (0-23)
|
|
200
|
+
*/
|
|
201
|
+
declare function getHoursFromTimeDifference(timeDifference: number): number;
|
|
202
|
+
/**
|
|
203
|
+
* Returns the total number of whole days in a time difference.
|
|
204
|
+
* @param timeDifference - Time difference in milliseconds
|
|
205
|
+
* @returns Total whole days
|
|
206
|
+
*/
|
|
207
|
+
declare function getTotalDaysFromTimeDifference(timeDifference: number): number;
|
|
208
|
+
/**
|
|
209
|
+
* Converts seconds to a time difference in milliseconds.
|
|
210
|
+
* @param seconds - Duration in seconds
|
|
211
|
+
* @returns Time difference in milliseconds
|
|
212
|
+
*/
|
|
213
|
+
declare function getTimeDifferenceFromSeconds(seconds: number): number;
|
|
214
|
+
/**
|
|
215
|
+
* Converts minutes to a time difference in milliseconds.
|
|
216
|
+
* @param minutes - Duration in minutes
|
|
217
|
+
* @returns Time difference in milliseconds
|
|
218
|
+
*/
|
|
219
|
+
declare function getTimeDifferenceFromMinutes(minutes: number): number;
|
|
220
|
+
/**
|
|
221
|
+
* Converts hours to a time difference in milliseconds.
|
|
222
|
+
* @param hours - Duration in hours
|
|
223
|
+
* @returns Time difference in milliseconds
|
|
224
|
+
*/
|
|
225
|
+
declare function getTimeDifferenceFromHours(hours: number): number;
|
|
226
|
+
/**
|
|
227
|
+
* Converts days to a time difference in milliseconds.
|
|
228
|
+
* @param days - Duration in days
|
|
229
|
+
* @returns Time difference in milliseconds
|
|
230
|
+
*/
|
|
231
|
+
declare function getTimeDifferenceFromDays(days: number): number;
|
|
232
|
+
/**
|
|
233
|
+
* Converts a TimeDifference object (days, hours, minutes, seconds) to milliseconds.
|
|
234
|
+
* @param timeDifferenceObject - Object with days, hours, minutes, and seconds fields
|
|
235
|
+
* @returns Time difference in milliseconds
|
|
236
|
+
*/
|
|
237
|
+
declare function getTimeDifferenceFromObject(timeDifferenceObject: TimeDifference): number;
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Returns the TAI-UTC leap seconds count for a given date.
|
|
241
|
+
* @param date - Date in GPS time scale
|
|
242
|
+
* @returns Number of TAI-UTC leap seconds
|
|
243
|
+
*/
|
|
244
|
+
declare function getLeap(date: Date): number;
|
|
245
|
+
/**
|
|
246
|
+
* Returns the GPS-UTC leap seconds count (TAI-UTC minus 19) for a given date.
|
|
247
|
+
* @param date - Date in GPS time scale
|
|
248
|
+
* @returns Number of GPS-UTC leap seconds
|
|
249
|
+
*/
|
|
250
|
+
declare function getGpsLeap(date: Date): number;
|
|
251
|
+
/**
|
|
252
|
+
* Converts a GPS-scale Date to UTC scale (applies leap seconds).
|
|
253
|
+
* @param date - Date in GPS time scale
|
|
254
|
+
* @returns Date in UTC time scale
|
|
255
|
+
*/
|
|
256
|
+
declare function getUtcDate(date: Date): Date;
|
|
257
|
+
/**
|
|
258
|
+
* Converts a UTC-scale Date to GPS scale (applies leap seconds).
|
|
259
|
+
* @param utc_date - Date in UTC time scale
|
|
260
|
+
* @returns Date in GPS time scale
|
|
261
|
+
*/
|
|
262
|
+
declare function getDateFromUtc(utc_date: Date): Date;
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Returns the Julian Date for a given Date and time scale.
|
|
266
|
+
* @param date - Date in GPS time scale
|
|
267
|
+
* @param scale - Time scale for the output (default: TT)
|
|
268
|
+
* @returns Julian Date in fractional days
|
|
269
|
+
*/
|
|
270
|
+
declare function getJulianDate(date: Date, scale?: Scale): number;
|
|
271
|
+
/**
|
|
272
|
+
* Converts a Julian Date to a Date.
|
|
273
|
+
* @param julianDate - Julian Date in fractional days
|
|
274
|
+
* @param scale - Time scale of the input Julian Date (default: TT)
|
|
275
|
+
* @returns Date in GPS time scale
|
|
276
|
+
*/
|
|
277
|
+
declare function getDateFromJulianDate(julianDate: number, scale?: Scale): Date;
|
|
278
|
+
/**
|
|
279
|
+
* Returns the Modified Julian Date for a given Date and time scale.
|
|
280
|
+
* @param date - Date in GPS time scale
|
|
281
|
+
* @param scale - Time scale for the output (default: TT)
|
|
282
|
+
* @returns Modified Julian Date in fractional days
|
|
283
|
+
*/
|
|
284
|
+
declare function getMJD(date: Date, scale?: Scale): number;
|
|
285
|
+
/**
|
|
286
|
+
* Converts a Modified Julian Date to a Date.
|
|
287
|
+
* @param mjd - Modified Julian Date in fractional days
|
|
288
|
+
* @param scale - Time scale of the input MJD (default: TT)
|
|
289
|
+
* @returns Date in GPS time scale
|
|
290
|
+
*/
|
|
291
|
+
declare function getDateFromMJD(mjd: number, scale?: Scale): Date;
|
|
292
|
+
/**
|
|
293
|
+
* Returns the MJD2000 (Modified Julian Date referenced to J2000.0) for a given Date.
|
|
294
|
+
* @param date - Date in GPS time scale
|
|
295
|
+
* @param scale - Time scale for the output (default: TT)
|
|
296
|
+
* @returns MJD2000 in fractional days
|
|
297
|
+
*/
|
|
298
|
+
declare function getMJD2000(date: Date, scale?: Scale): number;
|
|
299
|
+
/**
|
|
300
|
+
* Converts an MJD2000 value to a Date.
|
|
301
|
+
* @param mjd2000 - MJD2000 in fractional days
|
|
302
|
+
* @param scale - Time scale of the input MJD2000 (default: TT)
|
|
303
|
+
* @returns Date in GPS time scale
|
|
304
|
+
*/
|
|
305
|
+
declare function getDateFromMJD2000(mjd2000: number, scale?: Scale): Date;
|
|
306
|
+
|
|
307
|
+
export { HourCode, Scale, TimeDifference, getBdsTime, getDateFromBdsTime, getDateFromDayOfWeek, getDateFromDayOfYear, getDateFromGalTime, getDateFromGloN, getDateFromGpsData, getDateFromGpsTime, getDateFromHourCode, getDateFromJulianDate, getDateFromMJD, getDateFromMJD2000, getDateFromRINEX, getDateFromTai, getDateFromTimeOfDay, getDateFromTt, getDateFromUnixTime, getDateFromUtc, getDayOfWeek, getDayOfYear, getGalTime, getGloN4, getGloNA, getGpsLeap, getGpsTime, getHourCode, getHoursFromTimeDifference, getJulianDate, getLeap, getMJD, getMJD2000, getMinutesFromTimeDifference, getNtpTime, getRINEX, getSecondsFromTimeDifference, getTaiDate, getTimeDifference, getTimeDifferenceFromDays, getTimeDifferenceFromHours, getTimeDifferenceFromMinutes, getTimeDifferenceFromObject, getTimeDifferenceFromSeconds, getTimeOfDay, getTimeOfWeek, getTotalDaysFromTimeDifference, getTtDate, getUnixTime, getUtcDate, getWeekNumber, getWeekOfYear };
|
package/dist/time.d.ts
ADDED
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
import { H as HourCode, T as TimeDifference } from './time-DnI1VpE8.js';
|
|
2
|
+
export { D as DAYS_MJD2000_MJD, a as DAYS_MJD_JULIAN, M as MILLISECONDS_GPS_TAI, b as MILLISECONDS_IN_DAY, c as MILLISECONDS_IN_HOUR, d as MILLISECONDS_IN_MINUTE, e as MILLISECONDS_IN_SECOND, f as MILLISECONDS_IN_WEEK, g as MILLISECONDS_TT_TAI, R as RINEX_CODES, S as SECONDS_IN_DAY, h as SECONDS_IN_HOUR, i as SECONDS_IN_MINUTE, j as SECONDS_IN_WEEK, k as START_BDS_TIME, l as START_GAL_TIME, m as START_GLO_LEAP, n as START_GPS_TIME, o as START_JULIAN_TAI, p as START_MJD_UNIX_SECONDS, q as START_NTP_TIME, r as START_TAI_TIME, s as START_UNIX_TIME } from './time-DnI1VpE8.js';
|
|
3
|
+
|
|
4
|
+
declare enum Scale {
|
|
5
|
+
TAI = 0,
|
|
6
|
+
TT = 1,
|
|
7
|
+
GPS = 2,
|
|
8
|
+
UTC = 3
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** Returns milliseconds elapsed since the start of the UTC day. */
|
|
12
|
+
declare function getTimeOfDay(date: Date): number;
|
|
13
|
+
/** Reconstruct a Date from time-of-day in milliseconds and a reference date. */
|
|
14
|
+
declare function getDateFromTimeOfDay(timeOfDay: number, dateRaw: Date): Date;
|
|
15
|
+
/**
|
|
16
|
+
* Returns the day-of-year (1-366) for a given date.
|
|
17
|
+
* @param date - Date in GPS time scale
|
|
18
|
+
* @returns Day-of-year number (1-based)
|
|
19
|
+
*/
|
|
20
|
+
declare function getDayOfYear(date: Date): number;
|
|
21
|
+
/**
|
|
22
|
+
* Reconstructs a Date from a day-of-year and a reference date (preserves time-of-day).
|
|
23
|
+
* @param dayOfYear - Day-of-year number (1-based)
|
|
24
|
+
* @param date - Reference date in GPS time scale (year and time-of-day are used)
|
|
25
|
+
* @returns Date in GPS time scale
|
|
26
|
+
*/
|
|
27
|
+
declare function getDateFromDayOfYear(dayOfYear: number, date: Date): Date;
|
|
28
|
+
/**
|
|
29
|
+
* Returns the UTC day of the week (0 = Sunday, 6 = Saturday).
|
|
30
|
+
* @param date - Date in GPS time scale
|
|
31
|
+
* @returns Day of week (0-6)
|
|
32
|
+
*/
|
|
33
|
+
declare function getDayOfWeek(date: Date): number;
|
|
34
|
+
/**
|
|
35
|
+
* Reconstructs a Date by shifting a reference date to the given day of the week.
|
|
36
|
+
* @param dayOfWeek - Day of week (0 = Sunday, 6 = Saturday)
|
|
37
|
+
* @param dateRaw - Reference date in GPS time scale
|
|
38
|
+
* @returns Date in GPS time scale
|
|
39
|
+
*/
|
|
40
|
+
declare function getDateFromDayOfWeek(dayOfWeek: number, dateRaw: Date): Date;
|
|
41
|
+
/**
|
|
42
|
+
* Reconstructs a Date by setting the hour from a RINEX hour code ('a'-'x').
|
|
43
|
+
* @param hourCode - RINEX hour code letter ('a' = 00h, 'x' = 23h)
|
|
44
|
+
* @param date - Reference date in GPS time scale
|
|
45
|
+
* @returns Date in GPS time scale with the specified hour
|
|
46
|
+
*/
|
|
47
|
+
declare function getDateFromHourCode(hourCode: HourCode, date: Date): Date;
|
|
48
|
+
/**
|
|
49
|
+
* Returns the RINEX hour code ('a'-'x') for a given date.
|
|
50
|
+
* @param date - Date in GPS time scale
|
|
51
|
+
* @returns RINEX hour code letter ('a' = 00h, 'x' = 23h)
|
|
52
|
+
*/
|
|
53
|
+
declare function getHourCode(date: Date): HourCode;
|
|
54
|
+
/**
|
|
55
|
+
* Returns the ISO 8601 week number of the year (1-53).
|
|
56
|
+
* @param date - Date in GPS time scale
|
|
57
|
+
* @returns ISO week number
|
|
58
|
+
*/
|
|
59
|
+
declare function getWeekOfYear(date: Date): number;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Returns GPS time elapsed since the GPS epoch (6 Jan 1980) in milliseconds.
|
|
63
|
+
* @param date - Date in GPS time scale
|
|
64
|
+
* @returns GPS time in milliseconds
|
|
65
|
+
*/
|
|
66
|
+
declare function getGpsTime(date: Date): number;
|
|
67
|
+
/**
|
|
68
|
+
* Converts GPS time to a Date.
|
|
69
|
+
* @param gpsTime - GPS time in milliseconds since GPS epoch
|
|
70
|
+
* @returns Date in GPS time scale
|
|
71
|
+
*/
|
|
72
|
+
declare function getDateFromGpsTime(gpsTime: number): Date;
|
|
73
|
+
/**
|
|
74
|
+
* Returns Galileo time elapsed since the Galileo epoch in milliseconds.
|
|
75
|
+
* @param date - Date in GPS time scale
|
|
76
|
+
* @returns Galileo time in milliseconds
|
|
77
|
+
*/
|
|
78
|
+
declare function getGalTime(date: Date): number;
|
|
79
|
+
/**
|
|
80
|
+
* Converts Galileo time to a Date.
|
|
81
|
+
* @param galTime - Galileo time in milliseconds since Galileo epoch
|
|
82
|
+
* @returns Date in GPS time scale
|
|
83
|
+
*/
|
|
84
|
+
declare function getDateFromGalTime(galTime: number): Date;
|
|
85
|
+
/**
|
|
86
|
+
* Returns BeiDou time elapsed since the BDS epoch in milliseconds.
|
|
87
|
+
* @param date - Date in GPS time scale
|
|
88
|
+
* @returns BeiDou time in milliseconds
|
|
89
|
+
*/
|
|
90
|
+
declare function getBdsTime(date: Date): number;
|
|
91
|
+
/**
|
|
92
|
+
* Converts BeiDou time to a Date.
|
|
93
|
+
* @param bdsTime - BeiDou time in milliseconds since BDS epoch
|
|
94
|
+
* @returns Date in GPS time scale
|
|
95
|
+
*/
|
|
96
|
+
declare function getDateFromBdsTime(bdsTime: number): Date;
|
|
97
|
+
/**
|
|
98
|
+
* Converts a GPS-scale date to Unix time in milliseconds (applies leap seconds).
|
|
99
|
+
* @param date - Date in GPS time scale
|
|
100
|
+
* @returns Unix time in milliseconds
|
|
101
|
+
*/
|
|
102
|
+
declare function getUnixTime(date: Date): number;
|
|
103
|
+
/**
|
|
104
|
+
* Converts Unix time to a GPS-scale Date (applies leap seconds).
|
|
105
|
+
* @param unixTime - Unix time in milliseconds
|
|
106
|
+
* @returns Date in GPS time scale
|
|
107
|
+
*/
|
|
108
|
+
declare function getDateFromUnixTime(unixTime: number): Date;
|
|
109
|
+
/**
|
|
110
|
+
* Returns the GPS week number.
|
|
111
|
+
* @param date - Date in GPS time scale
|
|
112
|
+
* @returns GPS week number (continuous, not rolled over)
|
|
113
|
+
*/
|
|
114
|
+
declare function getWeekNumber(date: Date): number;
|
|
115
|
+
/** Returns GPS time-of-week in milliseconds. */
|
|
116
|
+
declare function getTimeOfWeek(date: Date): number;
|
|
117
|
+
/** Reconstruct a Date from GPS week number and time-of-week in milliseconds. */
|
|
118
|
+
declare function getDateFromGpsData(weekNumber: number, timeOfWeek: number): Date;
|
|
119
|
+
/**
|
|
120
|
+
* Converts a GPS-scale Date to TAI scale.
|
|
121
|
+
* @param date - Date in GPS time scale
|
|
122
|
+
* @returns Date in TAI time scale
|
|
123
|
+
*/
|
|
124
|
+
declare function getTaiDate(date: Date): Date;
|
|
125
|
+
/**
|
|
126
|
+
* Converts a TAI-scale Date to GPS scale.
|
|
127
|
+
* @param tai_date - Date in TAI time scale
|
|
128
|
+
* @returns Date in GPS time scale
|
|
129
|
+
*/
|
|
130
|
+
declare function getDateFromTai(tai_date: Date): Date;
|
|
131
|
+
/**
|
|
132
|
+
* Converts a GPS-scale Date to TT (Terrestrial Time) scale.
|
|
133
|
+
* @param date - Date in GPS time scale
|
|
134
|
+
* @returns Date in TT time scale
|
|
135
|
+
*/
|
|
136
|
+
declare function getTtDate(date: Date): Date;
|
|
137
|
+
/**
|
|
138
|
+
* Converts a TT-scale Date to GPS scale.
|
|
139
|
+
* @param tt_date - Date in TT time scale
|
|
140
|
+
* @returns Date in GPS time scale
|
|
141
|
+
*/
|
|
142
|
+
declare function getDateFromTt(tt_date: Date): Date;
|
|
143
|
+
/**
|
|
144
|
+
* Returns the GLONASS four-year interval number (N4) since 1996.
|
|
145
|
+
* @param date - Date in GPS time scale
|
|
146
|
+
* @returns GLONASS N4 period number (0-based)
|
|
147
|
+
*/
|
|
148
|
+
declare function getGloN4(date: Date): number;
|
|
149
|
+
/**
|
|
150
|
+
* Returns the GLONASS day number (NA) within the current four-year interval.
|
|
151
|
+
* @param date - Date in GPS time scale
|
|
152
|
+
* @returns Day number within the N4 period (1-based)
|
|
153
|
+
*/
|
|
154
|
+
declare function getGloNA(date: Date): number;
|
|
155
|
+
/** Reconstruct a Date from GLONASS N4 (4-year period), NA (day number), and time-of-day in milliseconds. */
|
|
156
|
+
declare function getDateFromGloN(n4: number, na: number, tod: number): Date;
|
|
157
|
+
/**
|
|
158
|
+
* Converts a GPS-scale Date to NTP time in milliseconds since the NTP epoch.
|
|
159
|
+
* @param date - Date in GPS time scale
|
|
160
|
+
* @returns NTP time in milliseconds
|
|
161
|
+
*/
|
|
162
|
+
declare function getNtpTime(date: Date): number;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Formats a Date as a RINEX epoch string (e.g. "> 2024 01 15 12 00 00.0000000").
|
|
166
|
+
* @param date - Date in GPS time scale
|
|
167
|
+
* @returns RINEX-formatted epoch string
|
|
168
|
+
*/
|
|
169
|
+
declare function getRINEX(date: Date): string;
|
|
170
|
+
/**
|
|
171
|
+
* Parses a RINEX epoch string into a Date.
|
|
172
|
+
* @param rinex - RINEX-formatted epoch string
|
|
173
|
+
* @returns Date in GPS time scale
|
|
174
|
+
*/
|
|
175
|
+
declare function getDateFromRINEX(rinex: string): Date;
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Returns the time difference between two dates in milliseconds.
|
|
179
|
+
* @param startDate - Start date
|
|
180
|
+
* @param finalDate - End date
|
|
181
|
+
* @returns Difference (finalDate - startDate) in milliseconds
|
|
182
|
+
*/
|
|
183
|
+
declare function getTimeDifference(startDate: Date, finalDate: Date): number;
|
|
184
|
+
/**
|
|
185
|
+
* Extracts the seconds component (0-59) from a time difference.
|
|
186
|
+
* @param timeDifference - Time difference in milliseconds
|
|
187
|
+
* @returns Seconds component (0-59)
|
|
188
|
+
*/
|
|
189
|
+
declare function getSecondsFromTimeDifference(timeDifference: number): number;
|
|
190
|
+
/**
|
|
191
|
+
* Extracts the minutes component (0-59) from a time difference.
|
|
192
|
+
* @param timeDifference - Time difference in milliseconds
|
|
193
|
+
* @returns Minutes component (0-59)
|
|
194
|
+
*/
|
|
195
|
+
declare function getMinutesFromTimeDifference(timeDifference: number): number;
|
|
196
|
+
/**
|
|
197
|
+
* Extracts the hours component (0-23) from a time difference.
|
|
198
|
+
* @param timeDifference - Time difference in milliseconds
|
|
199
|
+
* @returns Hours component (0-23)
|
|
200
|
+
*/
|
|
201
|
+
declare function getHoursFromTimeDifference(timeDifference: number): number;
|
|
202
|
+
/**
|
|
203
|
+
* Returns the total number of whole days in a time difference.
|
|
204
|
+
* @param timeDifference - Time difference in milliseconds
|
|
205
|
+
* @returns Total whole days
|
|
206
|
+
*/
|
|
207
|
+
declare function getTotalDaysFromTimeDifference(timeDifference: number): number;
|
|
208
|
+
/**
|
|
209
|
+
* Converts seconds to a time difference in milliseconds.
|
|
210
|
+
* @param seconds - Duration in seconds
|
|
211
|
+
* @returns Time difference in milliseconds
|
|
212
|
+
*/
|
|
213
|
+
declare function getTimeDifferenceFromSeconds(seconds: number): number;
|
|
214
|
+
/**
|
|
215
|
+
* Converts minutes to a time difference in milliseconds.
|
|
216
|
+
* @param minutes - Duration in minutes
|
|
217
|
+
* @returns Time difference in milliseconds
|
|
218
|
+
*/
|
|
219
|
+
declare function getTimeDifferenceFromMinutes(minutes: number): number;
|
|
220
|
+
/**
|
|
221
|
+
* Converts hours to a time difference in milliseconds.
|
|
222
|
+
* @param hours - Duration in hours
|
|
223
|
+
* @returns Time difference in milliseconds
|
|
224
|
+
*/
|
|
225
|
+
declare function getTimeDifferenceFromHours(hours: number): number;
|
|
226
|
+
/**
|
|
227
|
+
* Converts days to a time difference in milliseconds.
|
|
228
|
+
* @param days - Duration in days
|
|
229
|
+
* @returns Time difference in milliseconds
|
|
230
|
+
*/
|
|
231
|
+
declare function getTimeDifferenceFromDays(days: number): number;
|
|
232
|
+
/**
|
|
233
|
+
* Converts a TimeDifference object (days, hours, minutes, seconds) to milliseconds.
|
|
234
|
+
* @param timeDifferenceObject - Object with days, hours, minutes, and seconds fields
|
|
235
|
+
* @returns Time difference in milliseconds
|
|
236
|
+
*/
|
|
237
|
+
declare function getTimeDifferenceFromObject(timeDifferenceObject: TimeDifference): number;
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Returns the TAI-UTC leap seconds count for a given date.
|
|
241
|
+
* @param date - Date in GPS time scale
|
|
242
|
+
* @returns Number of TAI-UTC leap seconds
|
|
243
|
+
*/
|
|
244
|
+
declare function getLeap(date: Date): number;
|
|
245
|
+
/**
|
|
246
|
+
* Returns the GPS-UTC leap seconds count (TAI-UTC minus 19) for a given date.
|
|
247
|
+
* @param date - Date in GPS time scale
|
|
248
|
+
* @returns Number of GPS-UTC leap seconds
|
|
249
|
+
*/
|
|
250
|
+
declare function getGpsLeap(date: Date): number;
|
|
251
|
+
/**
|
|
252
|
+
* Converts a GPS-scale Date to UTC scale (applies leap seconds).
|
|
253
|
+
* @param date - Date in GPS time scale
|
|
254
|
+
* @returns Date in UTC time scale
|
|
255
|
+
*/
|
|
256
|
+
declare function getUtcDate(date: Date): Date;
|
|
257
|
+
/**
|
|
258
|
+
* Converts a UTC-scale Date to GPS scale (applies leap seconds).
|
|
259
|
+
* @param utc_date - Date in UTC time scale
|
|
260
|
+
* @returns Date in GPS time scale
|
|
261
|
+
*/
|
|
262
|
+
declare function getDateFromUtc(utc_date: Date): Date;
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Returns the Julian Date for a given Date and time scale.
|
|
266
|
+
* @param date - Date in GPS time scale
|
|
267
|
+
* @param scale - Time scale for the output (default: TT)
|
|
268
|
+
* @returns Julian Date in fractional days
|
|
269
|
+
*/
|
|
270
|
+
declare function getJulianDate(date: Date, scale?: Scale): number;
|
|
271
|
+
/**
|
|
272
|
+
* Converts a Julian Date to a Date.
|
|
273
|
+
* @param julianDate - Julian Date in fractional days
|
|
274
|
+
* @param scale - Time scale of the input Julian Date (default: TT)
|
|
275
|
+
* @returns Date in GPS time scale
|
|
276
|
+
*/
|
|
277
|
+
declare function getDateFromJulianDate(julianDate: number, scale?: Scale): Date;
|
|
278
|
+
/**
|
|
279
|
+
* Returns the Modified Julian Date for a given Date and time scale.
|
|
280
|
+
* @param date - Date in GPS time scale
|
|
281
|
+
* @param scale - Time scale for the output (default: TT)
|
|
282
|
+
* @returns Modified Julian Date in fractional days
|
|
283
|
+
*/
|
|
284
|
+
declare function getMJD(date: Date, scale?: Scale): number;
|
|
285
|
+
/**
|
|
286
|
+
* Converts a Modified Julian Date to a Date.
|
|
287
|
+
* @param mjd - Modified Julian Date in fractional days
|
|
288
|
+
* @param scale - Time scale of the input MJD (default: TT)
|
|
289
|
+
* @returns Date in GPS time scale
|
|
290
|
+
*/
|
|
291
|
+
declare function getDateFromMJD(mjd: number, scale?: Scale): Date;
|
|
292
|
+
/**
|
|
293
|
+
* Returns the MJD2000 (Modified Julian Date referenced to J2000.0) for a given Date.
|
|
294
|
+
* @param date - Date in GPS time scale
|
|
295
|
+
* @param scale - Time scale for the output (default: TT)
|
|
296
|
+
* @returns MJD2000 in fractional days
|
|
297
|
+
*/
|
|
298
|
+
declare function getMJD2000(date: Date, scale?: Scale): number;
|
|
299
|
+
/**
|
|
300
|
+
* Converts an MJD2000 value to a Date.
|
|
301
|
+
* @param mjd2000 - MJD2000 in fractional days
|
|
302
|
+
* @param scale - Time scale of the input MJD2000 (default: TT)
|
|
303
|
+
* @returns Date in GPS time scale
|
|
304
|
+
*/
|
|
305
|
+
declare function getDateFromMJD2000(mjd2000: number, scale?: Scale): Date;
|
|
306
|
+
|
|
307
|
+
export { HourCode, Scale, TimeDifference, getBdsTime, getDateFromBdsTime, getDateFromDayOfWeek, getDateFromDayOfYear, getDateFromGalTime, getDateFromGloN, getDateFromGpsData, getDateFromGpsTime, getDateFromHourCode, getDateFromJulianDate, getDateFromMJD, getDateFromMJD2000, getDateFromRINEX, getDateFromTai, getDateFromTimeOfDay, getDateFromTt, getDateFromUnixTime, getDateFromUtc, getDayOfWeek, getDayOfYear, getGalTime, getGloN4, getGloNA, getGpsLeap, getGpsTime, getHourCode, getHoursFromTimeDifference, getJulianDate, getLeap, getMJD, getMJD2000, getMinutesFromTimeDifference, getNtpTime, getRINEX, getSecondsFromTimeDifference, getTaiDate, getTimeDifference, getTimeDifferenceFromDays, getTimeDifferenceFromHours, getTimeDifferenceFromMinutes, getTimeDifferenceFromObject, getTimeDifferenceFromSeconds, getTimeOfDay, getTimeOfWeek, getTotalDaysFromTimeDifference, getTtDate, getUnixTime, getUtcDate, getWeekNumber, getWeekOfYear };
|