Changeset 7990


Ignore:
Timestamp:
04/10/19 04:06:16 (11 days ago)
Author:
stefan
Message:

Fixed extra second bug and read arc issue

Location:
branches/cosmos/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/cosmos/src/archiving/waveman2disk/waveman2disk.c

    r7912 r7990  
    891891                                        } 
    892892                                strcpy(LibDir, str); 
    893                         } 
     893                        }                                                                                                     
    894894 
    895895                    /*  */    else if (k_its ("TrigFile")) { 
  • branches/cosmos/src/libsrc/util/cosmos0putaway.c

    r7988 r7990  
    122122                strcpy(COSMOS0OutputFormat, OutputFormat); 
    123123        } 
     124 
     125 
    124126        return EW_SUCCESS; 
    125127} 
     
    162164        time_t  rawtime; 
    163165        struct tm * timeinfo; 
    164         size_t  nfbuffer;               /* Read bytes */ 
    165         char    *fbuffer;               /* File read buffer */ 
    166         static long      MaxMessageSize = 100000;  /* size (bytes) of largest msg */ 
    167166        HypoArc                 arcmsg;                 /* ARC message */ 
    168167        char            timestr[80];                                    /* Holds time messages */ 
     
    170169        struct tm * (*timefunc)(const time_t *); 
    171170        char            time_type[30] = { 0 };                                  /* Time type UTC or local */ 
     171        size_t  nfbuffer;               /* Read bytes */ 
     172        char    *fbuffer;               /* File read buffer */ 
     173        static long      MaxMessageSize = 100000;  /* size (bytes) of largest msg */ 
    172174 
    173175 
     
    204206 
    205207        /* If there's enough time to implement, this filename should be able to be specified in the dot D file. */ 
    206         sprintf(EventArcFile, "%s/event.arc", LibDir); 
     208        sprintf(cosmos_info->EventArcFile, "%s/event.arc", cosmos_info->LibDir); 
    207209        if (debug == 1) 
    208                 logit("t", "Attempting to open event file which always must be named event.arc and located in the LibraryDirectory. \n LibraryDirectory is currently configured as: %s\n", LibDir); 
     210                logit("t", "Attempting to open event file which always must be named event.arc and located in the LibraryDirectory. \n LibraryDirectory is currently configured as: %s\n", 
     211                        cosmos_info->LibDir); 
    209212 
    210213        /* open Event file just for reading */ 
    211         if ((EVENTARCfp = fopen(EventArcFile, "r")) == NULL) 
     214        if ((EVENTARCfp = fopen(cosmos_info->EventArcFile, "r")) == NULL) 
    212215        { 
    213216                logit("e", "COSMOS0PA_next_ev: unable to open file %s: %s\nAn .arc file is required to set event information in the COSMOS file format.", 
    214                         EventArcFile, strerror(errno)); 
     217                        cosmos_info->EventArcFile, strerror(errno)); 
    215218                return EW_FAILURE; 
    216219        } 
     
    230233        if (nfbuffer == 0) 
    231234        { 
    232                 logit( "eto", "COSMOS0PA_next_ev: No data read from %s\n\nAn .arc file is required to set event information in the COSMOS file format.", 
    233                         EventArcFile); 
     235                logit("eto", "COSMOS0PA_next_ev: No data read from %s\n\nAn .arc file is required to set event information in the COSMOS file format.", 
     236                        cosmos_info->EventArcFile); 
    234237                return EW_FAILURE; 
    235238        } 
    236239        /* We should be able to do something like               origintime = arcmsg.sum.ot - GSEC1970; after parse_arc */ 
    237         if (debug == 1) logit("et", "COSMOS0PA_next_ev: Debug: Arc parsing %s\n", EventArcFile); 
    238         if (parse_arc(fbuffer, &cosmos_info->arcmsg) != 0 ) 
     240        if (debug == 1) logit("et", "COSMOS0PA_next_ev: Debug: Arc parsing %s\n", cosmos_info->EventArcFile); 
     241        //if (parse_arc(fbuffer, &cosmos_info->arcmsg) != 0) 
     242        if (parse_arc_no_shdw(fbuffer, &cosmos_info->arcmsg) != 0) 
    239243        { 
    240244                logit("et", "COSMOS0PA_next_ev: Error parsing %s\n", 
    241                         EventArcFile); 
    242         } 
     245                        cosmos_info->EventArcFile); 
     246        } 
     247 
     248 
    243249 
    244250        return (EW_SUCCESS); 
     
    330336                return EW_FAILURE; 
    331337        } 
     338        else { 
     339                logit("e", "COSMOS0PA_next_ev: Opened file %s\n", 
     340                        COSMOS0LibFile); 
     341        } 
    332342 
    333343        if (debug == 1) 
     
    353363        } 
    354364        */ 
    355         while (fgets(str, COSMOSLINELEN, COSMOS0Libfp) != NULL) { 
     365        while ((fgets(str, COSMOSLINELEN, COSMOS0Libfp) != NULL) && (LineNumber < 48)) { 
    356366                LineNumber++; 
    357367                sprintf(tempstr, "                                                                                ");/*clear it*/ 
     
    453463                                (timeinfo->tm_year + 1900), (timeinfo->tm_mon + 1), timeinfo->tm_mday, 
    454464                                timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); 
    455                         fprintf(COSMOS0fp, "%s", tempstr); 
     465                        fprintf(COSMOS0fp, "%s\n", tempstr); 
    456466                        break; 
    457467                default: 
     
    580590        sprintf(tempstr2, "%d secs", seconds); 
    581591        strncpy(tempstr + 34, tempstr2, strlen(tempstr2)); 
     592        if (!COSMOS0fp) { 
     593                logit("et", "Tried to write to a null file pointer, exiting. Does your library match your waveserver request?\n"); 
     594                exit(0); 
     595        } 
    582596        if (fwrite(tempstr, 81, 1, COSMOS0fp) != 1) 
    583597        { 
     
    706720 
    707721 
    708         while ((j < nsamp_this_scn) && (currenttime < getThis->reqEndtime)) 
     722        while ((j < nsamp_this_scn) && (currenttime < getThis->reqEndtime) && (j < raw_counts)) 
    709723        { 
    710724                /* Only give them what they asked for, not each sample we got back. 
     
    729743 
    730744                /* WRITE DATA */ 
    731  
    732                 while (i < 10 && j < nsamp_this_scn) 
     745                /* Even if there are more samples in this scn, we shouldn't have more than the raw counts the user asked for*/ 
     746                while (i < 10 && j < nsamp_this_scn && j < raw_counts) 
    733747                { 
    734748                        sprintf(eightdigits, "        "); /* we want leading spaces */ 
     
    799813int COSMOS0PA_end_ev(int debug) 
    800814{ 
    801         fclose(COSMOS0fp); 
     815        /* Actually we opened multiple files, one for each SCNL, and they should  
     816          all be closed by the time we get here; we don't know who they all are to  
     817          close them here. */ 
     818/*      fclose(COSMOS0fp); 
    802819 
    803820        if (debug == 1) 
    804                 logit("t", "Closing COSMOS0 file \n"); 
     821                logit("t", "Closing COSMOS0 file \n"); */ 
    805822 
    806823        return(EW_SUCCESS); 
Note: See TracChangeset for help on using the changeset viewer.