equal
deleted
inserted
replaced
1 #====================================================================== |
1 #====================================================================== |
2 # L I B C O N V . P L |
2 # L I B C O N V . P L |
3 # doc: Sat Dec 4 13:03:49 1999 |
3 # doc: Sat Dec 4 13:03:49 1999 |
4 # dlm: Mon Dec 18 14:27:19 2017 |
4 # dlm: Tue May 22 11:19:54 2018 |
5 # (c) 1999 A.M. Thurnherr |
5 # (c) 1999 A.M. Thurnherr |
6 # uE-Info: 67 36 NIL 0 0 70 2 2 4 NIL ofnI |
6 # uE-Info: 68 41 NIL 0 0 70 2 2 4 NIL ofnI |
7 #====================================================================== |
7 #====================================================================== |
8 |
8 |
9 # HISTORY: |
9 # HISTORY: |
10 # Dec 12, 1999: - created for the Rainbow CM data as libdate |
10 # Dec 12, 1999: - created for the Rainbow CM data as libdate |
11 # Jul 07, 2000: - renamed to libconv and added lat/lon conversions |
11 # Jul 07, 2000: - renamed to libconv and added lat/lon conversions |
63 # - BUG: mmddyy2dec_time() did not allow for optional epoch argument |
63 # - BUG: mmddyy2dec_time() did not allow for optional epoch argument |
64 # Aug 7, 2014: - finally cleaned up date conversions |
64 # Aug 7, 2014: - finally cleaned up date conversions |
65 # Jan 27, 2017: - BUG: dayNo() numeric month could have leading/trailing whitespace |
65 # Jan 27, 2017: - BUG: dayNo() numeric month could have leading/trailing whitespace |
66 # Jul 6, 2017: - BUG: date conversion routines did not parse 1/5/12 correctly |
66 # Jul 6, 2017: - BUG: date conversion routines did not parse 1/5/12 correctly |
67 # Dec 18, 2017: - removed ambiguous-date warning |
67 # Dec 18, 2017: - removed ambiguous-date warning |
|
68 # May 22, 2018: - added NMEA2dec_time() |
68 |
69 |
69 require "$ANTS/libEOS83.pl"; # &sigma() |
70 require "$ANTS/libEOS83.pl"; # &sigma() |
70 require "$ANTS/libPOSIX.pl"; # &floor() |
71 require "$ANTS/libPOSIX.pl"; # &floor() |
71 require "$ANTS/libstats.pl"; # &min(),&max() |
72 require "$ANTS/libstats.pl"; # &min(),&max() |
72 |
73 |
185 |
186 |
186 #---------------------------------------------------------------------- |
187 #---------------------------------------------------------------------- |
187 # String to Decimal Time Conversion |
188 # String to Decimal Time Conversion |
188 #---------------------------------------------------------------------- |
189 #---------------------------------------------------------------------- |
189 |
190 |
|
191 sub NMEA2dec_time(@) |
|
192 { |
|
193 my($NMEA_string,$epoch) = &antsFunUsage(-1,'.','<NMEA string>[, epoch]',@_); |
|
194 |
|
195 # Mar 17 2018 01:23:09 |
|
196 my($month,$day,$year,$time) = split(/\s+/,$NMEA_string); |
|
197 $epoch = $year unless defined($epoch); |
|
198 return dayNo($year,$month,$day,$epoch) + frac_day(split(':',$time)); |
|
199 } |
|
200 |
190 { my($date_fmt); |
201 { my($date_fmt); |
191 |
202 |
192 sub str2dec_time(@) # heuristic |
203 sub str2dec_time(@) # heuristic |
193 { |
204 { |
194 my($ds,$ts,$epoch) = |
205 my($ds,$ts,$epoch) = |