Changeset 5013 for trunk/psLib/src/types
- Timestamp:
- Sep 12, 2005, 3:04:39 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/types/psMetadataConfig.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/types/psMetadataConfig.c
r5011 r5013 10 10 * @author Eric Van Alst, MHPCC 11 11 * 12 * @version $Revision: 1.4 2$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-09-1 2 23:40:01$12 * @version $Revision: 1.43 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-09-13 01:04:39 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 250 250 251 251 return value; 252 } 253 254 /** Returns a psTime structure */ 255 static psTime *parseTime(char *inString, 256 psTimeType tt, 257 psS32 *status) 258 { 259 psTime *out; 260 long sec = 0; 261 unsigned int nsec = 0; 262 char *end = NULL; 263 out = psTimeAlloc(tt); 264 265 sec = strtol(inString, &end, 10); 266 out->sec = sec; 267 while (!strncmp(end, " ", 1)) 268 end++; 269 inString = end; 270 nsec = (unsigned int)strtoul(inString, &end, 10); 271 out->nsec = nsec; 272 if (out->sec == 0 && out->nsec == 0) 273 *status = 1; 274 while (!strncmp(end, " ", 1)) 275 end++; 276 inString = end; 277 if ( !strncmp(inString, "false", 10) || !strncmp(inString, "f", 10) || 278 !strncmp(inString, "FALSE", 10) || !strncmp(inString, " F", 10) ) 279 out->leapsecond = false; 280 else if ( !strncmp(inString, "true", 10) || !strncmp(inString, "t", 10) || 281 !strncmp(inString, "TRUE", 10) || !strncmp(inString, "T", 10) ) 282 out->leapsecond = true; 283 else { 284 *status = 1; 285 } 286 return out; 252 287 } 253 288 … … 717 752 psMetadata* tempMeta = NULL; 718 753 p_psParseLevelInfo* nextLevelInfo = NULL; 754 psTime *mTime; 755 psTimeType timeType; 719 756 720 757 // Get the metadata item type … … 774 811 } else if(!strncmp(strType, "METADATA", 8)) { 775 812 mdType = PS_META_META; 813 } else if( !strncmp(strType, "PS_TIME_UTC", 12) || !strncmp(strType, "PS_TIME_TAI", 12) 814 || !strncmp(strType, "PS_TIME_UT1", 12) || !strncmp(strType, "PS_TIME_TT", 12)) { 815 mdType = PS_META_TIME; 776 816 } else { 777 817 // Search through user types … … 895 935 returnValue = false; 896 936 } 937 break; 938 case PS_META_TIME: 939 if( !strncmp(strType, "PS_TIME_UTC", 12) ) 940 timeType = PS_TIME_UTC; 941 else if( !strncmp(strType, "PS_TIME_TAI", 12) ) 942 timeType = PS_TIME_TAI; 943 else if( !strncmp(strType, "PS_TIME_UT1", 12) ) 944 timeType = PS_TIME_UT1; 945 else if( !strncmp(strType, "PS_TIME_TT", 12) ) 946 timeType = PS_TIME_TT; 947 mTime = parseTime(strValue, timeType, &status); 948 if(!status) { 949 addStatus = psMetadataAdd(md, PS_LIST_TAIL, keyName, 950 mdType | flags, 951 strComment, mTime); 952 } else { 953 psError(PS_ERR_IO, true, PS_ERRORTEXT_psMetadataIO_PARSE_FAILED, strValue, keyName, 954 strType, lineCount, fileName); 955 returnValue = false; 956 } 957 psFree(mTime); 897 958 break; 898 959 case PS_META_VEC:
Note:
See TracChangeset
for help on using the changeset viewer.
