Changeset 7942
- Timestamp:
- Jul 20, 2006, 2:59:07 AM (20 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/astro/psTime.c (modified) (21 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astro/psTime.c
r7766 r7942 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1.9 0$ $Name: not supported by cvs2svn $13 * @date $Date: 2006-0 6-30 02:20:06$12 * @version $Revision: 1.91 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2006-07-20 12:59:07 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 387 387 388 388 // Read time tables 389 bool no_problem = true; // True if we've detected no errors 389 390 namesPtr = tableNames; 390 391 while((tableName=getToken(&namesPtr, " ", &status)) != NULL) { … … 403 404 tableFormat = getToken(&formatPtr,",",&status); 404 405 if(tableFormat == NULL) { 405 psError(PS_ERR_BAD_PARAMETER_VALUE, true,PS_ERRORTEXT_psTime_LOOKUP_METADATA_FAILED,406 psError(PS_ERR_BAD_PARAMETER_VALUE,no_problem,PS_ERRORTEXT_psTime_LOOKUP_METADATA_FAILED, 406 407 "psLib.time.tables.format"); 408 no_problem = false; 407 409 } 408 410 … … 412 414 numLines = psLookupTableRead(table); 413 415 } else { 414 psError(PS_ERR_BAD_PARAMETER_VALUE, true, PS_ERRORTEXT_psTime_BAD_TABLE_COUNT, i+1, numTables); 416 psError(PS_ERR_BAD_PARAMETER_VALUE, no_problem, 417 PS_ERRORTEXT_psTime_BAD_TABLE_COUNT, i+1, numTables); 418 no_problem = false; 415 419 } 416 420 … … 424 428 foundTable = true; 425 429 } else if(foundTable==false && j==numTables-1) { 426 psError(PS_ERR_BAD_PARAMETER_VALUE, true, PS_ERRORTEXT_psTime_BAD_TABLE_COUNT, j, numTables); 430 psError(PS_ERR_BAD_PARAMETER_VALUE, no_problem, 431 PS_ERRORTEXT_psTime_BAD_TABLE_COUNT, j, numTables); 432 no_problem = false; 427 433 } 428 434 } … … 438 444 439 445 if(numTables != i) { 440 psError(PS_ERR_BAD_PARAMETER_VALUE, true, PS_ERRORTEXT_psTime_BAD_TABLE_COUNT, i, numTables);446 psError(PS_ERR_BAD_PARAMETER_VALUE, no_problem, PS_ERRORTEXT_psTime_BAD_TABLE_COUNT, i, numTables); 441 447 } 442 448 … … 448 454 psFree(tableFormats); 449 455 450 return true;456 return no_problem; 451 457 } 452 458 … … 698 704 if(time->type == PS_TIME_UT1) { 699 705 psError(PS_ERR_BAD_PARAMETER_VALUE,true,"Cannot convert from UT1 time type"); 700 // return NULL; 701 return time; 706 return NULL; 702 707 } 703 708 … … 724 729 } else { 725 730 psError(PS_ERR_BAD_PARAMETER_VALUE, true, PS_ERRORTEXT_psTime_TYPE_UNKNOWN, type); 731 return NULL; 726 732 } 727 733 // Convert from TT to TAI, UTC, UT1 … … 748 754 } else { 749 755 psError(PS_ERR_BAD_PARAMETER_VALUE, true, PS_ERRORTEXT_psTime_TYPE_UNKNOWN, type); 756 return NULL; 750 757 } 751 758 // Convert from UTC to TAI, TT, UT1 … … 766 773 } else { 767 774 psError(PS_ERR_BAD_PARAMETER_VALUE, true, PS_ERRORTEXT_psTime_TYPE_UNKNOWN, type); 775 return NULL; 768 776 } 769 777 // Convert unknown time type 770 778 } else { 771 779 psError(PS_ERR_BAD_PARAMETER_VALUE, true, PS_ERRORTEXT_psTime_TYPE_UNKNOWN, time->type); 780 return NULL; 772 781 } 773 782 … … 1065 1074 1066 1075 // Date too earlier for tables. Get default polar coodinate values from metadata, and issue warning. 1076 #if 0 1067 1077 psError(PS_ERR_BAD_PARAMETER_VALUE, true, PS_ERRORTEXT_psTime_TIME_PREDATES_TABLES, mjd, "polar motion"); 1078 return NULL; 1079 #else 1080 1081 psLogMsg(PS_FILE_LINE, PS_LOG_ERROR, PS_ERRORTEXT_psTime_TIME_PREDATES_TABLES, mjd, "polar motion"); 1082 #endif 1068 1083 1069 1084 tableMetadataItem = psMetadataLookup(timeMetadata, "psLib.time.before.xp"); 1070 1085 if(tableMetadataItem == NULL) { 1071 psError(PS_ERR_BAD_PARAMETER_VALUE, true, PS_ERRORTEXT_psTime_LOOKUP_METADATA_FAILED, "psLib.time.before.xp"); 1086 psError(PS_ERR_BAD_PARAMETER_VALUE, true, 1087 PS_ERRORTEXT_psTime_LOOKUP_METADATA_FAILED, "psLib.time.before.xp"); 1072 1088 return NULL; 1073 1089 } … … 1092 1108 c = 2*pi*(mjd - pslib.time.predict.mjd)/435.0 1093 1109 */ 1094 psError(PS_ERR_BAD_PARAMETER_VALUE, true, PS_ERRORTEXT_psTime_TIME_POSTDATES_TABLES, mjd, "polar motion"); 1110 #if 0 1111 psError(PS_ERR_BAD_PARAMETER_VALUE, true, 1112 PS_ERRORTEXT_psTime_TIME_POSTDATES_TABLES, mjd, "polar motion"); 1113 return NULL; 1114 #else 1115 1116 psLogMsg(PS_FILE_LINE, PS_LOG_ERROR, 1117 PS_ERRORTEXT_psTime_TIME_POSTDATES_TABLES, mjd, "polar motion"); 1118 #endif 1095 1119 1096 1120 // Get predicted MJD … … 1171 1195 psError(PS_ERR_BAD_PARAMETER_VALUE, true, PS_ERRORTEXT_psTime_FILE_NOT_FOUND, 1172 1196 p_psGetConfigFileName()); 1173 return 0.0;1197 return NAN; 1174 1198 } 1175 1199 … … 1178 1202 if(tableMetadataItem == NULL) { 1179 1203 psError(PS_ERR_BAD_PARAMETER_VALUE, true, PS_ERRORTEXT_psTime_LOOKUP_METADATA_FAILED, "taiTable"); 1180 return 0.0;1204 return NAN; 1181 1205 } 1182 1206 table = (psLookupTable*)tableMetadataItem->data.V; … … 1205 1229 if(results == NULL) { 1206 1230 psError(PS_ERR_BAD_PARAMETER_VALUE, true, PS_ERRORTEXT_psTime_INTERPOLATION_FAILED); 1231 return NAN; 1207 1232 } 1208 1233 … … 1347 1372 if (!strftime(tempString, MAX_TIME_STRING_LENGTH, "%Y-%m-%dT%H:%M:%S", tmTime)) { 1348 1373 psError(PS_ERR_OS_CALL_FAILED, true, PS_ERRORTEXT_psTime_CONVERT_TIME_TO_STRING_FAILED); 1374 return NULL; 1349 1375 } 1350 1376 psFree(tmTime); … … 1360 1386 if (snprintf(timeString, MAX_TIME_STRING_LENGTH, "%s.%1dZ", tempString, ds) < 0) { 1361 1387 psError(PS_ERR_OS_CALL_FAILED, true, PS_ERRORTEXT_psTime_APPEND_MSEC_FAILED); 1388 return NULL; 1362 1389 } 1363 1390 psFree(tempString); … … 1699 1726 const psTime *time2) 1700 1727 { 1701 psF64 out = 0.0;1702 1728 psF64 uSec1 = 0.0; 1703 1729 psF64 uSec2 = 0.0; … … 1714 1740 if(time1->type != time2->type) { 1715 1741 psError(PS_ERR_BAD_PARAMETER_VALUE,true,PS_ERRORTEXT_psTime_TYPE_INCORRECT,time1->type); 1716 return out;1742 return NAN; 1717 1743 } 1718 1744 … … 1739 1765 uSec2 = tempTime2->sec >= 0 ? 1.0 : -1.0; 1740 1766 uSec2 = uSec2*tempTime2->nsec/1e9; 1741 out = (tempTime1->sec-tempTime2->sec) + (uSec1-uSec2);1767 psF64 out = (tempTime1->sec-tempTime2->sec) + (uSec1-uSec2); 1742 1768 1743 1769 psFree(tempTime1);
Note:
See TracChangeset
for help on using the changeset viewer.
