libconv.pl
changeset 33 f891ea33a728
parent 30 1a1a12d5edc1
child 35 d3f6ca34c4ea
equal deleted inserted replaced
32:4c6434bb5124 33:f891ea33a728
     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: Fri Jan 27 10:47:21 2017
     4 #                    dlm: Thu Jul  6 15:27:13 2017
     5 #                    (c) 1999 A.M. Thurnherr
     5 #                    (c) 1999 A.M. Thurnherr
     6 #                    uE-Info: 194 13 NIL 0 0 70 2 2 4 NIL ofnI
     6 #                    uE-Info: 66 80 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
    60 #	Aug  2, 2011: - enhanced yymmdd2dec_time()
    60 #	Aug  2, 2011: - enhanced yymmdd2dec_time()
    61 #	Apr 17, 2012: - added space as another date separator in ddmmyy2dec_time
    61 #	Apr 17, 2012: - added space as another date separator in ddmmyy2dec_time
    62 #	May 22, 2012: - BUG: illegal time spec error was also produced on missing seconds
    62 #	May 22, 2012: - BUG: illegal time spec error was also produced on missing seconds
    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 
    67 
    67 require "$ANTS/libEOS83.pl";                        # &sigma()
    68 require "$ANTS/libEOS83.pl";                        # &sigma()
    68 require "$ANTS/libPOSIX.pl";                        # &floor()
    69 require "$ANTS/libPOSIX.pl";                        # &floor()
    69 require "$ANTS/libstats.pl";                        # &min(),&max()
    70 require "$ANTS/libstats.pl";                        # &min(),&max()
    70 
    71 
   223         &antsFunUsage(-2,"..","MM/DD/[YY]YY, hh:mm[:ss][, epoch]",@_);
   224         &antsFunUsage(-2,"..","MM/DD/[YY]YY, hh:mm[:ss][, epoch]",@_);
   224 
   225 
   225 	my($time) = 0;
   226 	my($time) = 0;
   226 	if ($ds ne '') {
   227 	if ($ds ne '') {
   227 		my($yy,$mm,$dd);
   228 		my($yy,$mm,$dd);
   228 		if (length($ds) == 6) {
   229 		if (length($ds) == 6 && $ds =~ m{^\d+$}) {
   229 			$mm = substr($ds,0,2);
   230 			$mm = substr($ds,0,2);
   230 			$dd = substr($ds,2,2);
   231 			$dd = substr($ds,2,2);
   231 			$yy = substr($ds,4,2);
   232 			$yy = substr($ds,4,2);
   232 		} else {
   233 		} else {
   233 			($mm,$dd,$yy) = split('[-/\.]',$ds);
   234 			($mm,$dd,$yy) = split('[-/\.]',$ds);
   248         &antsFunUsage(-2,"..","DD/MM/[YY]YY, hh:mm[:ss][, epoch]",@_);
   249         &antsFunUsage(-2,"..","DD/MM/[YY]YY, hh:mm[:ss][, epoch]",@_);
   249 
   250 
   250 	my($time) = 0;
   251 	my($time) = 0;
   251 	if ($ds ne '') {
   252 	if ($ds ne '') {
   252 		my($yy,$mm,$dd);
   253 		my($yy,$mm,$dd);
   253 		if (length($ds) == 6) {
   254 		if (length($ds) == 6 && $ds =~ m{^\d+$}) {
   254 			$dd = substr($ds,0,2);
   255 			$dd = substr($ds,0,2);
   255 			$mm = substr($ds,2,2);
   256 			$mm = substr($ds,2,2);
   256 			$yy = substr($ds,4,2);
   257 			$yy = substr($ds,4,2);
   257 		} else {
   258 		} else {
   258 			($dd,$mm,$yy) = split('[-/\.]',$ds);
   259 			($dd,$mm,$yy) = split('[-/\.]',$ds);
   275         &antsFunUsage(-2,"..","[YY]YY/MM/DD, hh:mm[:ss][, epoch]",@_);
   276         &antsFunUsage(-2,"..","[YY]YY/MM/DD, hh:mm[:ss][, epoch]",@_);
   276 
   277 
   277 	my($time) = 0;
   278 	my($time) = 0;
   278 	if ($ds ne '') {								
   279 	if ($ds ne '') {								
   279 		my($yy,$mm,$dd);
   280 		my($yy,$mm,$dd);
   280 		if (length($ds) == 6) {
   281 		if (length($ds) == 6 && $ds =~ m{^\d+$}) {
   281 			$yy = substr($ds,0,2);
   282 			$yy = substr($ds,0,2);
   282 			$mm = substr($ds,2,2);
   283 			$mm = substr($ds,2,2);
   283 			$dd = substr($ds,4,2);
   284 			$dd = substr($ds,4,2);
   284 		} else {
   285 		} else {
   285 			($yy,$mm,$dd) = split('[-/\.]',$ds);
   286 			($yy,$mm,$dd) = split('[-/\.]',$ds);