Changeset 5015
- Timestamp:
- Sep 12, 2005, 3:09:58 PM (21 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 4 edited
-
astro/Makefile.am (modified) (1 diff)
-
astro/psTime.c (modified) (10 diffs)
-
astro/psTime.h (modified) (3 diffs)
-
sys/psString.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astro/Makefile.am
r4981 r5015 1 1 #Makefile for astronomy functions of psLib 2 2 # 3 AM_CFLAGS=$(CFLAGS) -DPS_CONFIG_FILE_DEFAULT=\"$(sysconfdir)/pslib/ps Time.config\"3 AM_CFLAGS=$(CFLAGS) -DPS_CONFIG_FILE_DEFAULT=\"$(sysconfdir)/pslib/pslib.config\" 4 4 5 5 noinst_LTLIBRARIES = libpslibastro.la -
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 -
trunk/psLib/src/astro/psTime.h
r4944 r5015 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.3 8$ $Name: not supported by cvs2svn $14 * @date $Date: 2005-09- 02 21:32:03$13 * @version $Revision: 1.39 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2005-09-13 01:09:58 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 26 26 #include "psType.h" 27 27 #include "psImage.h" 28 #include "psLookupTable.h" 28 29 #include "psCoord.h" 29 30 … … 360 361 char* p_psGetConfigFileName(); 361 362 363 psF64 p_psTimeSearchTables( 364 psF64 index, 365 psU64 column, 366 char *metadataTableNames[], 367 psU32 nTables, 368 psLookupStatusType* status 369 ); 370 362 371 /// @} 363 372 -
trunk/psLib/src/sys/psString.h
r4434 r5015 13 13 * @author Eric Van Alst, MHPCC 14 14 * 15 * @version $Revision: 1.1 5$ $Name: not supported by cvs2svn $16 * @date $Date: 2005-0 6-30 00:33:36$15 * @version $Revision: 1.16 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2005-09-13 01:09:58 $ 17 17 * 18 18 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 64 64 psString psStringNCopy( 65 65 const char *string, ///< Input string of characters to copy 66 unsigned int nChar ///< Number of bytes to allocate for string copy66 unsigned int nChar ///< Number of bytes to allocate for string copy 67 67 ); 68 68
Note:
See TracChangeset
for help on using the changeset viewer.
