Changeset 5015 for trunk/psLib/src/astro/psTime.c
- Timestamp:
- Sep 12, 2005, 3:09:58 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/astro/psTime.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astro/psTime.c
r4944 r5015 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1. 69$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-09- 02 21:32:03$12 * @version $Revision: 1.70 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-09-13 01:09:58 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 88 88 static char *cleanString(char *inString, int sLen); 89 89 static char* getToken(char **inString, char *delimiter, psParseErrorType *status); 90 static psF64 searchTables(psF64 index, psU64 column, char *metadataTableNames[],91 psU32 nTables, psLookupStatusType* status);92 90 static psTime* convertTimeTAIUTC(psTime* time); 93 91 static psTime* convertTimeUTCTAI(psTime* time); … … 156 154 } 157 155 158 // get the ps Time.config filename by checking environment variable first, then original installation area.156 // get the pslib.config filename by checking environment variable first, then original installation area. 159 157 char* p_psGetConfigFileName() 160 158 { … … 171 169 // Searches time tables in priority order and performs interpolation if input index value is within a table. 172 170 // If the index value is out of range, the status is set accordingly. 173 static psF64 searchTables(psF64 index, psU64 column, char *metadataTableNames[],174 psU32 nTables, psLookupStatusType* status)171 psF64 p_psTimeSearchTables(psF64 index, psU64 column, char *metadataTableNames[], 172 psU32 nTables, psLookupStatusType* status) 175 173 { 176 174 char* tableName = NULL; … … 179 177 psMetadataItem* tableMetadataItem = NULL; 180 178 181 // Check time metadata. Function call reports errors. 182 if(timeMetadata == NULL) { 183 if(!p_psTimeInit(p_psGetConfigFileName())) 184 *status = PS_LOOKUP_ERROR; 179 // Check if psTime tables are already loaded 180 if(!p_psTimeInit(p_psGetConfigFileName())) { 181 *status = PS_LOOKUP_ERROR; 185 182 return NAN; 186 183 } … … 254 251 char metadataTableNames[4][MAX_STRING_LENGTH] = {"daily", "eopc", "finals", "tai"}; 255 252 256 // Read time config file 253 // Check if the p_psTimeInit has already been ran 254 if (timeMetadata != NULL) { 255 return true; 256 } 257 258 // Read config file 257 259 timeMetadata = psMetadataConfigParse(timeMetadata, &nFail, fileName, true); 258 260 if(timeMetadata == NULL) { … … 847 849 // Attempt to find value through table lookup and interpolation 848 850 mjd = psTimeToMJD(time); 849 result = searchTables(mjd,tableColumn,metadataTableNames,nTables,&status);851 result = p_psTimeSearchTables(mjd,tableColumn,metadataTableNames,nTables,&status); 850 852 851 853 // Value could not be found through table lookup and interpolation … … 855 857 psLogMsg(__func__,PS_LOG_WARN,PS_ERRORTEXT_psTime_TIME_PREDATES_TABLES,mjd,"UT1-UTC"); 856 858 857 // Lookup value from time metadata loaded from ps Time.config859 // Lookup value from time metadata loaded from pslib.config 858 860 tableMetadataItem = psMetadataLookup(timeMetadata, "psLib.time.before.dut"); 859 861 if(tableMetadataItem == NULL) { … … 926 928 // Attempt to find value through table lookup and interpolation 927 929 mjd = psTimeToMJD(time); 928 // x = searchTables(mjd, 0, &xStatus, metadataTableNames, nTables);929 x = searchTables(mjd, 0, metadataTableNames, nTables,&xStatus);930 // y = searchTables(mjd, 0, &yStatus, metadataTableNames, nTables);931 y = searchTables(mjd, 0, metadataTableNames, nTables,&yStatus);930 // x = p_psTimeSearchTables(mjd, 0, &xStatus, metadataTableNames, nTables); 931 x = p_psTimeSearchTables(mjd, 0, metadataTableNames, nTables,&xStatus); 932 // y = p_psTimeSearchTables(mjd, 0, &yStatus, metadataTableNames, nTables); 933 y = p_psTimeSearchTables(mjd, 0, metadataTableNames, nTables,&yStatus); 932 934 933 935 // Value could not be found through table lookup and interpolation … … 1037 1039 PS_ASSERT_INT_WITHIN_RANGE(time->nsec,0,(psU32)((1e9)-1),NAN); 1038 1040 1039 // Check time metadata 1040 if(timeMetadata == NULL) { 1041 if(!p_psTimeInit(p_psGetConfigFileName())) { 1042 psError(PS_ERR_BAD_PARAMETER_VALUE, true, PS_ERRORTEXT_psTime_FILE_NOT_FOUND, "psTime.config"); 1043 return 0.0; 1044 } 1041 // Check if psTime tables are loaded/loadable 1042 if(!p_psTimeInit(p_psGetConfigFileName())) { 1043 psError(PS_ERR_BAD_PARAMETER_VALUE, true, PS_ERRORTEXT_psTime_FILE_NOT_FOUND, 1044 p_psGetConfigFileName()); 1045 return 0.0; 1045 1046 } 1046 1047
Note:
See TracChangeset
for help on using the changeset viewer.
