IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 26, 2009, 10:25:53 AM (17 years ago)
Author:
Paul Price
Message:

Convert the time to the nominated system before writing.

File:
1 edited

Legend:

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

    r22677 r22683  
    639639}
    640640
     641// Determine the corresponding TIMESYS for one of the TIME concepts
     642static psTimeType conceptGetTimesysForTime(const char *name, // Concept name ("CELL.TIME" or "FPA.TIME")
     643                                           const pmFPA *fpa, // FPA of interest
     644                                           const pmChip *chip, // Chip of interest, or NULL
     645                                           const pmCell *cell // Cell of interest, or NULL
     646                                           )
     647{
     648    assert(name);
     649
     650    psString timesysName = psStringCopy(name); // e.g., "CELL.TIME" --> "CELL.TIMESYS"
     651    psStringSubstitute(&timesysName, "TIMESYS", "TIME");
     652    bool mdok = false;                  // Result of MD lookup
     653    psTimeType timeSys = 0xFFFFFFFF;    // The time system
     654    if (cell) {
     655        timeSys = psMetadataLookupS32(&mdok, cell->concepts, timesysName);
     656    }
     657    if (!mdok && chip) {
     658        timeSys = psMetadataLookupS32(&mdok, chip->concepts, timesysName);
     659    }
     660    if (!mdok && fpa) {
     661        timeSys = psMetadataLookupS32(&mdok, fpa->concepts, timesysName);
     662    }
     663    if (!mdok || (timeSys == 0xFFFFFFFF)) {
     664        psWarning("Unable to find %s in concepts when parsing %s --- assuming UTC.\n",
     665                  timesysName, name);
     666        timeSys = PS_TIME_UTC;
     667    }
     668    psFree(timesysName);
     669
     670    return timeSys;
     671}
     672
    641673psMetadataItem *p_pmConceptParse_TIME(const psMetadataItem *concept,
    642674                                      const psMetadataItem *pattern,
     
    650682    assert(cameraFormat);
    651683
    652     // Need TIMESYS first
    653     psString timesysName = psStringCopy(pattern->name); // e.g., "CELL.TIME" --> "CELL.TIMESYS"
    654     psStringSubstitute(&timesysName, "TIMESYS", "TIME");
    655     bool mdok = false;                  // Result of MD lookup
    656     psTimeType timeSys = PS_TIME_UTC; // The time system
    657     if (cell) {
    658         timeSys = psMetadataLookupS32(&mdok, cell->concepts, timesysName);
    659     }
    660     if (!mdok && chip) {
    661         timeSys = psMetadataLookupS32(&mdok, chip->concepts, timesysName);
    662     }
    663     if (!mdok && fpa) {
    664         timeSys = psMetadataLookupS32(&mdok, fpa->concepts, timesysName);
    665     }
    666     if (!mdok || (timeSys == 0xffffffff)) {
    667         psWarning("Unable to find %s in concepts when parsing %s --- assuming UTC.\n",
    668                   timesysName, pattern->name);
    669         timeSys = PS_TIME_UTC;
    670     }
    671     psFree(timesysName);
     684    psTimeType timeSys = conceptGetTimesysForTime(pattern->name, fpa, chip, cell); // Time system
    672685
    673686    // Work out how the time is represented
     
    681694
    682695    // Get format
     696    bool mdok;                          // Status of MD lookup
    683697    psMetadata *formats = psMetadataLookupMetadata(&mdok, cameraFormat, "FORMATS");
    684698    if (!mdok || !formats) {
     
    11341148{
    11351149    psTime *time = concept->data.V;     // The time
     1150
     1151    psTimeType timeSys = conceptGetTimesysForTime(concept->name, fpa, chip, cell); // Time system
     1152    psTimeConvert(time, timeSys);
    11361153
    11371154    // Work out the format
Note: See TracChangeset for help on using the changeset viewer.