IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 7281


Ignore:
Timestamp:
Jun 1, 2006, 4:14:47 PM (20 years ago)
Author:
magnier
Message:

added tests for missing CELL.TIME concepts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/concepts/pmConceptsStandard.c

    r7278 r7281  
    306306}
    307307
    308 
    309308psMetadataItem *p_pmConceptParse_CELL_TIME(psMetadataItem *concept,
    310309        psMetadataItem *pattern,
     
    335334    // Get format
    336335    psMetadata *formats = psMetadataLookupMD(&mdok, cameraFormat, "FORMATS");
    337     if (mdok && formats) {
    338         psString timeFormat = psMetadataLookupStr(&mdok, formats, "CELL.TIME");
    339         if (mdok && timeFormat && strlen(timeFormat) > 0) {
    340             // Parse the time format
    341             psList *timeFormats = psStringSplit(timeFormat, " ,;", false); // List of the format options
    342             psListIterator *timeFormatsIter = psListIteratorAlloc(timeFormats, PS_LIST_HEAD, false); // Iter
    343             while ((timeFormat = psListGetAndIncrement(timeFormatsIter))) {
    344                 if (strcasecmp(timeFormat, "USA") == 0) {
    345                     usaTime = true;
    346                     backwardsTime = false;
    347                     jdTime = false;
    348                     mjdTime = false;
    349                 } else if (strcasecmp(timeFormat, "BACKWARDS") == 0) {
    350                     backwardsTime = true;
    351                     usaTime = false;
    352                     jdTime = false;
    353                     mjdTime = false;
    354                 } else if (strcasecmp(timeFormat, "PRE2000") == 0) {
    355                     pre2000Time = true;
    356                 } else if (strcasecmp(timeFormat, "MJD") == 0) {
    357                     mjdTime = true;
    358                     jdTime = false;
    359                     backwardsTime = false;
    360                     usaTime = false;
    361                 } else if (strcasecmp(timeFormat, "JD") == 0) {
    362                     jdTime = true;
    363                     mjdTime = false;
    364                     backwardsTime = false;
    365                     usaTime = false;
    366                 } else {
    367                     psLogMsg(__func__, PS_LOG_WARN, "Unrecognised FORMATS option for CELL.TIME: %s --- "
    368                              "ignored.\n", timeFormat);
    369                 }
    370             }
    371             psFree(timeFormatsIter);
    372             psFree(timeFormats);
    373         }
    374     }
     336    if (!mdok || !formats)
     337        return NULL;
     338
     339    psString timeFormat = psMetadataLookupStr(&mdok, formats, "CELL.TIME");
     340    if (!mdok || !timeFormat || !strlen(timeFormat))
     341        return NULL;
     342
     343    // Parse the time format
     344    psList *timeFormats = psStringSplit(timeFormat, " ,;", false); // List of the format options
     345    psListIterator *timeFormatsIter = psListIteratorAlloc(timeFormats, PS_LIST_HEAD, false); // Iter
     346    while ((timeFormat = psListGetAndIncrement(timeFormatsIter))) {
     347        if (strcasecmp(timeFormat, "USA") == 0) {
     348            usaTime = true;
     349            backwardsTime = false;
     350            jdTime = false;
     351            mjdTime = false;
     352        } else if (strcasecmp(timeFormat, "BACKWARDS") == 0) {
     353            backwardsTime = true;
     354            usaTime = false;
     355            jdTime = false;
     356            mjdTime = false;
     357        } else if (strcasecmp(timeFormat, "PRE2000") == 0) {
     358            pre2000Time = true;
     359        } else if (strcasecmp(timeFormat, "MJD") == 0) {
     360            mjdTime = true;
     361            jdTime = false;
     362            backwardsTime = false;
     363            usaTime = false;
     364        } else if (strcasecmp(timeFormat, "JD") == 0) {
     365            jdTime = true;
     366            mjdTime = false;
     367            backwardsTime = false;
     368            usaTime = false;
     369        } else {
     370            psLogMsg(__func__, PS_LOG_WARN, "Unrecognised FORMATS option for CELL.TIME: %s --- "
     371                     "ignored.\n", timeFormat);
     372            return NULL;
     373        }
     374    }
     375    psFree(timeFormatsIter);
     376    psFree(timeFormats);
    375377
    376378    psTime *time = NULL;                // The time
Note: See TracChangeset for help on using the changeset viewer.