Changeset 44
- Timestamp:
- 05/19/09 15:57:30 (16 years ago)
- Location:
- drsdaq
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
drsdaq/DAQReadout.cc
r36 r44 74 74 FirstBoard = 0; 75 75 LastBoard = -1; 76 snprintf(Source,sizeof(Source),"DUMMY");77 76 78 77 // Read configuration file … … 206 205 void DAQReadout::cmd_events() { 207 206 if(daq_state != active) PrintMessage("DAQ not active.\n"); 208 else PrintMessage("Current number of events: %d \n", NumEvents);207 else PrintMessage("Current number of events: %d (of %d requested)\n", NumEvents, NumEventsRequested); 209 208 } 210 209 … … 254 253 if (NParam==4) { 255 254 NumEventsRequested = atoi(Param[2]); 256 strcpy(Source, Param[3]); 257 } 255 strncpy(RHeader->Description, Param[3], sizeof(RHeader->Description)); 256 } 257 else snprintf(RHeader->Description,sizeof(RHeader->Description),"DUMMY"); 258 258 259 259 // Determine new run number using the file RUN_NUM_FILE … … 463 463 " DAQ: %s\n" 464 464 " Run number: %d\n" 465 " Run type: % c\n"465 " Run type: %s\n" 466 466 " Event: %d\n" 467 467 " Requested events per run: %d\n" … … 472 472 " Active CMC boards: %d\n", 473 473 daq_state_str[daq_state], daq_state==active ? (int) RunNumber:-1, 474 daq_runtype_str[daq_runtype] [0], NumEvents,474 daq_runtype_str[daq_runtype], NumEvents, 475 475 NumEventsRequested, fRawDataPath, 476 476 CheckDisk(fRawDataPath), Socket==-1 ? "disconnected":"connected", … … 882 882 // Generate filename 883 883 snprintf(FileName,sizeof(FileName),"%s/%s/%s_%.8u_%s_%c_%d.raw", fRawDataPath, RunDate, 884 RunDate,RunNumber, Source,daq_runtype_str[daq_runtype][0],FileNumber);884 RunDate,RunNumber,RHeader->Description,daq_runtype_str[daq_runtype][0],FileNumber); 885 885 886 886 // Open file with rwx right for owner and group, never overwrite file … … 896 896 bool DAQReadout::WriteRunHeader() { 897 897 898 time_t time_now_secs; 899 struct tm *time_now; 898 struct timeval Time; 900 899 901 900 RHeader->MagicNum = MAGICNUM_OPEN; 902 RHeader->DataFormat = DATA_FORMAT; 901 RHeader->DataFormat = DATA_FORMAT; 902 RHeader->SoftwareRevision = atoi(REVISION); 903 903 904 RHeader->RunHeaderSize = sizeof(RunHeader); 904 905 RHeader->EventHeaderSize = sizeof(EventHeader); 905 906 RHeader->BoardStructureSize = sizeof(BoardStructure); 906 strcpy(RHeader->DAQVersion, __DATE__); 907 908 strcpy(RHeader->Source, Source); 909 RHeader->Type = daq_runtype_str[daq_runtype][0]; 907 908 RHeader->Type = daq_runtype; 910 909 RHeader->RunNumber = RunNumber; 911 910 RHeader->FileNumber = FileNumber; 912 911 913 time(&time_now_secs); 914 time_now = localtime(&time_now_secs); 915 916 RHeader->StartYear = 1900 + time_now->tm_year; 917 RHeader->StartMonth = 1 + time_now->tm_mon; 918 RHeader->StartDay = time_now->tm_mday; 919 RHeader->StartHour = time_now->tm_hour; 920 RHeader->StartMinute = time_now->tm_min; 921 RHeader->StartSecond = time_now->tm_sec; 922 923 RHeader->SourceRA = -1; 924 RHeader->SourceDEC = -1; 925 RHeader->TelescopeRA = -1; 926 RHeader->TelescopeDEC = -1; 927 912 gettimeofday(&Time, NULL); 913 RHeader->StartSecond = Time.tv_sec; 914 RHeader->StartMicrosecond = Time.tv_usec; 915 928 916 RHeader->NCMCBoards = NumCMCBoards==0 && daq_runtype==test ? 1 : (LastBoard - FirstBoard) + 1; 929 917 RHeader->NChips = kNumberOfChips; … … 958 946 } 959 947 960 // Update the run header 948 // Update the run header before closing file 961 949 bool DAQReadout::UpdateRunHeader(unsigned int Events, bool Error) { 962 950 963 time_t time_now_secs; 964 struct tm *time_now; 951 struct timeval Time; 965 952 966 953 RHeader->MagicNum = Error==false ? MAGICNUM_CLOSED:MAGICNUM_ERROR; 967 954 RHeader->Events = Events; 968 955 969 time(&time_now_secs); 970 time_now = localtime(&time_now_secs); 971 972 RHeader->EndYear = 1900 + time_now->tm_year; 973 RHeader->EndMonth = 1 + time_now->tm_mon; 974 RHeader->EndDay = time_now->tm_mday; 975 RHeader->EndHour = time_now->tm_hour; 976 RHeader->EndMinute = time_now->tm_min; 977 RHeader->EndSecond = time_now->tm_sec; 956 gettimeofday(&Time, NULL); 957 RHeader->EndSecond = Time.tv_sec; 958 RHeader->EndMicrosecond = Time.tv_usec; 978 959 979 960 if(lseek(Rawfile,0,SEEK_SET)==-1) { … … 996 977 gettimeofday(&Time, NULL); 997 978 998 strcpy(EHeader->Name,"EVTH");999 979 EHeader->EventNumber = NumEvents; 1000 EHeader->TriggerType = 0XFFFF; 1001 EHeader->TimeSec = Time.tv_sec + (float) Time.tv_usec/1000000.; 980 EHeader->TriggerType = 0x0; 981 EHeader->Seconds = Time.tv_sec; 982 EHeader->Microseconds = Time.tv_usec; 983 EHeader->EventSize = sizeof(short)*RHeader->NCMCBoards*RHeader->NChips*RHeader->NChannels*RHeader->Samples; 1002 984 1003 985 if(write(Rawfile, EHeader, sizeof(EventHeader)) != sizeof(EventHeader)) { … … 1173 1155 gettimeofday(&StartTime, NULL); 1174 1156 1175 m->PrintMessage("\rStarting run #%d (%s) on \"%s\" with %u event(s)\n",m->RunNumber,daq_runtype_str[m->daq_runtype],m-> Source,m->NumEventsRequested);1157 m->PrintMessage("\rStarting run #%d (%s) on \"%s\" with %u event(s)\n",m->RunNumber,daq_runtype_str[m->daq_runtype],m->RHeader->Description,m->NumEventsRequested); 1176 1158 do { 1177 1159 // Check if enough disk space is left … … 1253 1235 m->PrintMessage("\rRun #%d (%s) %s, %d events\n",m->RunNumber,daq_runtype_str[m->daq_runtype],(m->NumEvents == m->NumEventsRequested) ? "completed":"stopped",m->NumEvents); 1254 1236 m->SlowDataClass->NewEntry("Runinfo"); 1255 m->SlowDataClass->AddToEntry("%d %s %s %d ",m->RunNumber,daq_runtype_str[m->daq_runtype],m->Source,m->NumEvents);1237 m->SlowDataClass->AddToEntry("%d %s %s %d %d",m->RunNumber,daq_runtype_str[m->daq_runtype],m->RHeader->Description,m->NumEvents,m->FileNumber); 1256 1238 } 1257 1239 else m->PrintMessage("\rRun #%d (%s) aborted due to error after %d events\n",m->RunNumber,daq_runtype_str[m->daq_runtype],m->NumEvents); -
drsdaq/DAQReadout.h
r36 r44 80 80 unsigned int NumEventsRequested; // Number of events requested 81 81 unsigned int RunNumber, FileNumber; 82 char Source[32];83 82 char FileName[MAX_PATH]; 84 83 -
drsdaq/HVFeedback.cc
r36 r44 55 55 PrintConfig(); 56 56 57 // Initialise 57 // Initialise with zero content 58 58 Average = new float [m->NumCMCBoards][kNumberOfChips][kNumberOfChannels](); 59 59 Sigma = new float [m->NumCMCBoards][kNumberOfChips][kNumberOfChannels](); … … 62 62 Buffer = new float [m->NumCMCBoards][kNumberOfChips][kNumberOfChannels](); 63 63 64 /* for (int i=m->FirstBoard; i<=m->LastBoard; i++)65 for (int j=0; j<kNumberOfChips; j++)66 for (int k=0; k<kNumberOfChannels; k++) {67 Response[i][j][k] = 0.0;68 Target[i][j][k] = 0.0;69 }70 */71 64 Gain = 1; 72 65 SetFBMode(FB_Off); -
drsdaq/History.txt
r36 r44 24 24 will let run go until stopped manually. Feedback writes slow data. 25 25 29/4/2009 DAQ writes run summary to slow data file. 26 14/5/2009 Streamlined raw data format. 27 18/5/2009 Included some version and size checking in RawDataCTX.cc. 28 19/5/2009 Subversion revision number included in run header. Added human readable 29 date and time to slow data. -
drsdaq/Makefile
r36 r44 12 12 SOURCES = HVFeedback.cc DAQReadout.cc RawDataCTX.cc SlowData.cc ../pixelmap/Pixel.cc ../pixelmap/PixelMap.cc DRS/DRS.cc DRS/mxml.c DRS/strlcpy.c drsdaq.cpp 13 13 OBJECTS = $(addsuffix .o, $(basename $(SOURCES))) 14 INCDIRS = -I. -IDRS -I../pixelmap 14 15 15 INCDIRS = -I. -IDRS -I../pixelmap 16 REVISION = $(shell svnversion -n) 16 17 17 18 ifeq ($(VMECTRL),-DCT_VME) … … 24 25 endif 25 26 26 CFLAGS = -pipe -fthread-jumps -funroll-all-loops -O3 -Wall -DOS_LINUX 27 CPPFLAGS = -pipe -fPIC -fthread-jumps -funroll-all-loops -O3 -Wall -DOS_LINUX $(VMECTRL) 27 CPPFLAGS = -DREVISION='"$(REVISION)"' -O3 -Wall $(VMECTRL) 28 28 LIBS = -lstdc++ -lz -lpthread -lutil -lfl $(VMELIB) 29 29 … … 41 41 42 42 %.o : %.c 43 $(CC) $(C FLAGS) $(INCDIRS) -c -o $@ $<43 $(CC) $(CPPFLAGS) $(INCDIRS) -c -o $@ $< 44 44 %.o : %.cc 45 45 $(CC) $(CPPFLAGS) $(INCDIRS) -c -o $@ $< -
drsdaq/RawDataCTX.cc
r36 r44 48 48 return CTX_RHEADER; 49 49 } 50 // Check if version of this software is not older than raw data format 51 if (RHeader->DataFormat > DATA_FORMAT) { 52 if(!Silent) printf("Error: Data format too new, incompatible with this read-out routine\n"); 53 fclose(Rawfile); 54 return CTX_VERSION; 55 } 56 // Check if allocated headers are long enough 57 if (RHeader->RunHeaderSize>sizeof(RunHeader) || RHeader->BoardStructureSize>sizeof(BoardStructure) || RHeader->EventHeaderSize>sizeof(EventHeader)) { 58 if(!Silent) printf("Error: Header size(s) too long (there must be a problem with the data version!)\n"); 59 fclose(Rawfile); 60 return CTX_VERSION; 61 } 62 50 63 // Read board structures 51 64 BStruct = new BoardStructure [RHeader->NCMCBoards]; 52 if(fread(BStruct, sizeof(BoardStructure), RHeader->NCMCBoards, Rawfile) != RHeader->NCMCBoards) { 53 if(!Silent) printf("Error: Could not read (all) board structures\n"); 54 fclose(Rawfile); 55 delete[] BStruct; 56 return CTX_BSTRUCT; 65 for(unsigned int i=0; i<RHeader->NCMCBoards; i++) { 66 if(fread(&BStruct[i], RHeader->BoardStructureSize, 1, Rawfile) != 1) { 67 if(!Silent) printf("Error: Could not read board structure of board number %d\n",i+1); 68 fclose(Rawfile); 69 delete[] BStruct; 70 return CTX_BSTRUCT; 71 } 57 72 } 58 73 // Allocate memory for event data … … 63 78 if(fptr != NULL) { 64 79 fprintf(fptr, "Magic number %x (%s)\n", RHeader->MagicNum, RHeader->MagicNum==MAGICNUM_CLOSED?"OK":(RHeader->MagicNum==MAGICNUM_OPEN?"File not closed":"Error")); 65 fprintf(fptr, "Data format: %d\n", RHeader->DataFormat); 80 fprintf(fptr, "Data format: %u\n", RHeader->DataFormat); 81 fprintf(fptr, "Software revision: %u\n", RHeader->SoftwareRevision); 82 66 83 fprintf(fptr, "Run header size: %d\n", RHeader->RunHeaderSize); 67 84 fprintf(fptr, "Event header size: %d\n", RHeader->EventHeaderSize); 68 85 fprintf(fptr, "Board structure size: %d\n", RHeader->BoardStructureSize); 69 70 fprintf(fptr, "DAQ compilation: %s\n", RHeader->DAQVersion); 71 fprintf(fptr, "Source: %s\n", RHeader->Source); 72 fprintf(fptr, "Run type: %c\n", RHeader->Type); 86 87 fprintf(fptr, "Description: %s\n", RHeader->Description); 88 fprintf(fptr, "Run type: %u\n", RHeader->Type); 73 89 fprintf(fptr, "Run number: %u\n", RHeader->RunNumber); 74 90 fprintf(fptr, "File number: %u\n", RHeader->FileNumber); 91 75 92 fprintf(fptr, "Events: %u\n", RHeader->Events); 76 93 fprintf(fptr, "CMC Boards: %u\n", RHeader->NCMCBoards); … … 78 95 fprintf(fptr, "Channels/chip: %u\n", RHeader->NChannels); 79 96 fprintf(fptr, "Samples: %u\n", RHeader->Samples); 80 fprintf(fptr, "Offset: % d\n", RHeader->Offset);97 fprintf(fptr, "Offset: %u\n", RHeader->Offset); 81 98 82 fprintf(fptr, "Source RA: %f\n", RHeader->SourceRA); 83 fprintf(fptr, "Source DEC: %f\n", RHeader->SourceDEC); 84 fprintf(fptr, "Telescope RA: %f\n", RHeader->TelescopeRA); 85 fprintf(fptr, "Telescope DEC: %f\n", RHeader->TelescopeDEC); 86 87 fprintf(fptr, "Start year: %u\n", RHeader->StartYear); 88 fprintf(fptr, "Start month: %u\n", RHeader->StartMonth); 89 fprintf(fptr, "Start day: %u\n", RHeader->StartDay); 90 fprintf(fptr, "Start hour: %u\n", RHeader->StartHour); 91 fprintf(fptr, "Start minute: %u\n", RHeader->StartMinute); 92 fprintf(fptr, "Start second: %u\n", RHeader->StartSecond); 93 fprintf(fptr, "End year: %u\n", RHeader->EndYear); 94 fprintf(fptr, "End month: %u\n", RHeader->EndMonth); 95 fprintf(fptr, "End day: %u\n", RHeader->EndDay); 96 fprintf(fptr, "End hour: %u\n", RHeader->EndHour); 97 fprintf(fptr, "End minute: %u\n", RHeader->EndMinute); 98 fprintf(fptr, "End second: %u\n", RHeader->EndSecond); 99 fprintf(fptr, "Start second: %u - UTC %s", RHeader->StartSecond, asctime(gmtime((time_t *) &RHeader->StartSecond))); 100 fprintf(fptr, " microsecond: %u\n", RHeader->StartMicrosecond); 101 fprintf(fptr, "End second: %u - UTC %s", RHeader->EndSecond, asctime(gmtime((time_t *) &RHeader->EndSecond))); 102 fprintf(fptr, " microsecond: %u\n", RHeader->EndMicrosecond); 99 103 100 104 for (unsigned int i=0; i<RHeader->NCMCBoards; i++) { … … 127 131 128 132 // *** Read next event from file 129 CTX_ErrCode RawDataCTX::ReadEvent( int EventNo, FILE *fptr) {133 CTX_ErrCode RawDataCTX::ReadEvent(unsigned int EventNo, FILE *fptr) { 130 134 131 if (!FileOpen) {135 if (!FileOpen) { 132 136 if(!Silent) printf("Error: No data file open.\n"); 133 137 return CTX_NOTOPEN; 134 138 } 135 139 136 // Move file pointer to desired event header (if zero read next event)137 if(EventNo!=0 && fseek(Rawfile, sizeof(RunHeader)+sizeof(BoardStructure)*RHeader->NCMCBoards+(EventNo-1)*(sizeof(EventHeader)+RHeader->NCMCBoards*RHeader->NChips*140 /* // Move file pointer to desired event header (if zero read next event) 141 if(EventNo!=0 && fseek(Rawfile, RHeader->RunHeaderSize+RHeader->BoardStructureSize*RHeader->NCMCBoards+(EventNo-1)*(RHeader->EventHeaderSize+RHeader->NCMCBoards*RHeader->NChips* 138 142 RHeader->NChannels*RHeader->Samples*sizeof(short)), SEEK_SET)!=0) { 139 143 if(!Silent) printf("Error: Could not move to requested event\n"); 140 144 return CTX_SEEK; 141 145 } 146 */ 142 147 148 // Move file pointer to desired event header (if zero read next event) 149 if (EventNo != 0) { 150 bool SEEK_OK=true; 151 if (fseek(Rawfile, RHeader->RunHeaderSize+RHeader->BoardStructureSize*RHeader->NCMCBoards, SEEK_SET) != 0) SEEK_OK=false; 152 while(SEEK_OK) { 153 if (fread(EHeader, RHeader->EventHeaderSize, 1, Rawfile) != 0) SEEK_OK = false; 154 else { 155 if (EHeader->EventNumber==EventNo) break; 156 if (fseek(Rawfile, EHeader->EventSize, SEEK_CUR) != 0) SEEK_OK = false; 157 } 158 } 159 if(!SEEK_OK) { 160 if(!Silent) printf("Error: Could not move to requested event\n"); 161 return CTX_SEEK; 162 } 163 } 143 164 // Read event header 144 if (fread(EHeader, sizeof(EventHeader), 1, Rawfile) != 1) {145 if (feof(Rawfile)==0) {146 if (!Silent) printf("Error: Could not read event header\n");165 else if (fread(EHeader, RHeader->EventHeaderSize, 1, Rawfile) != 1) { 166 if (feof(Rawfile)==0) { 167 if (!Silent) printf("Error: Could not read event header\n"); 147 168 return CTX_EHEADER; 148 169 } 149 170 else return CTX_EOF; 150 171 } 151 if(fread(Data, sizeof(short), RHeader->NCMCBoards*RHeader->NChips*RHeader->NChannels*RHeader->Samples, Rawfile) 152 != RHeader->NCMCBoards*RHeader->NChips*RHeader->NChannels*RHeader->Samples) { 153 if(!Silent) printf("Error: Could not read (all) data\n"); 172 if(fread(Data, 1, EHeader->EventSize, Rawfile) != EHeader->EventSize) { 173 if(!Silent) printf("Error: Could not read (all) event data\n"); 154 174 return CTX_DATA; 155 175 } … … 157 177 // If requested, print event header to file 158 178 if(fptr != NULL) { 159 fprintf(fptr, "Name: %s\n", EHeader->Name); 160 fprintf(fptr, "Event number: %u\n", EHeader->EventNumber); 161 fprintf(fptr, "Time [s]: %f\n", EHeader->TimeSec); 162 fprintf(fptr, "Trigger type: 0X%0X\n", EHeader->TriggerType); 179 fprintf(fptr, "Event number: %u\n", EHeader->EventNumber); 180 fprintf(fptr, "Time [sec]: %u - UTC %s", EHeader->Seconds, asctime(gmtime((time_t *) &EHeader->Seconds))); 181 fprintf(fptr, "Time [usec]: %u\n", EHeader->Microseconds); 182 fprintf(fptr, "Trigger type: 0x%0X\n", EHeader->TriggerType); 183 fprintf(fptr, "Size [byte]: %u\n", EHeader->EventSize); 163 184 } 164 185 -
drsdaq/RawDataCTX.h
r36 r44 11 11 Structures are defined using #pragma pack (1) to not include any padding. Note that 12 12 using the gcc attribute __attribute__((__packed__)) is incompatible with root. 13 14 15 The convention for the header structure is that exisitng structure entries 16 should never be deleted. New items may only be added at the end. 13 17 */ 14 18 … … 17 21 18 22 #include <stdio.h> 23 #include <time.h> 19 24 20 25 #define DATA_FORMAT 1 … … 34 39 // Error codes 35 40 enum CTX_ErrCode {CTX_OK, CTX_FOPEN, CTX_FCLOSE, CTX_NOTOPEN, CTX_RHEADER, 36 CTX_BSTRUCT, CTX_EHEADER, CTX_DATA, CTX_SEEK, CTX_EOF };41 CTX_BSTRUCT, CTX_EHEADER, CTX_DATA, CTX_SEEK, CTX_EOF, CTX_VERSION}; 37 42 38 43 #pragma pack (1) // Switch padding off … … 41 46 typedef struct { 42 47 U32 MagicNum; 43 U32 DataFormat; // Increasing whenever header format changes 48 U32 DataFormat; // Increasing whenever format changes 49 U32 SoftwareRevision; // Subversion revision number 44 50 45 51 U32 RunHeaderSize; … … 47 53 U32 BoardStructureSize; 48 54 49 I8 DAQVersion[12]; // contains result of __DATE__ macro 50 51 I8 Source[16]; 52 I8 Type; // run type (char): pedestal, data, ... 55 I8 Description[48]; 56 U32 Type; // Run type: 0=pedestal, 1=data, 2=test 53 57 54 58 U32 RunNumber; 55 59 U32 FileNumber; 56 57 U32 StartYear; 58 U32 StartMonth; 59 U32 StartDay; 60 U32 StartHour; 61 U32 StartMinute; 62 U32 StartSecond; 63 64 U32 EndYear; 65 U32 EndMonth; 66 U32 EndDay; 67 U32 EndHour; 68 U32 EndMinute; 60 61 U32 Events; // Number of events in the file 62 U32 NCMCBoards; // Number of used mezzanine boards 63 U32 NChips; // Number of DRS chips per board 64 U32 NChannels; // Number of channels per chip 65 U32 Samples; // Number of samples 66 U32 Offset; // Offset from first sample 67 68 U32 StartSecond; // Opening and closing time of the file 69 U32 StartMicrosecond; 69 70 U32 EndSecond; 70 71 F32 SourceRA; 72 F32 SourceDEC; 73 F32 TelescopeRA; 74 F32 TelescopeDEC; 75 76 U32 Events; // Number of events in the file 77 U32 NCMCBoards; // Number of used boards 78 U32 NChips; // Number of DRS chips per board 79 U32 NChannels; // Number of channels per chip 80 U32 Samples; // Number of samples 81 I32 Offset; // Offset from first sample 71 U32 EndMicrosecond; 82 72 } RunHeader; 83 73 84 74 // Board structure 85 75 typedef struct { 86 I32 SerialNo; // Board serial number87 F32 NomFreq; 88 F32 BoardTemp; // Board temperature [deg C]89 F32 ScaleFactor; // Factor for conversion to mV76 I32 SerialNo; // Board serial number 77 F32 NomFreq; // Nominal sampling frequency [GHz] 78 F32 BoardTemp; // Board temperature [deg C] 79 F32 ScaleFactor; // Factor for conversion to mV 90 80 } BoardStructure; 91 81 92 82 // Event header 93 83 typedef struct { 94 I8 Name[5]; // "EVTH", NULL-terminated95 84 U32 EventNumber; 96 F32 TimeSec; // event time stamp in seconds, ms precision 97 U16 TriggerType; 85 U32 Seconds; // Event time stamp (result of gettimeofday()) 86 U32 Microseconds; 87 U32 TriggerType; 88 U32 EventSize; // Size of following data in bytes 98 89 } EventHeader; 99 90 … … 104 95 FILE *Rawfile; 105 96 bool FileOpen; 106 bool Silent; 97 bool Silent; // No textual output if true 107 98 108 99 public: … … 117 108 CTX_ErrCode OpenDataFile(char*, FILE* = NULL); 118 109 CTX_ErrCode CloseDataFile(); 119 CTX_ErrCode ReadEvent( int = 0, FILE* = NULL);110 CTX_ErrCode ReadEvent(unsigned int = 0, FILE* = NULL); 120 111 bool IsFileOpen(); 121 112 }; -
drsdaq/SlowData.cc
r36 r44 47 47 bool SlowData::NewEntry(char *Variable) { 48 48 49 time_t RawTime; 50 struct tm *TM; 49 51 struct timeval Time; 50 52 53 time(&RawTime); 54 TM = localtime(&RawTime); 51 55 gettimeofday(&Time, NULL); 52 56 InternalCall = true; 53 NewEntryCalled = AddToEntry("\n%s %s %lu %lu ", Issuer, Variable, Time.tv_sec, Time.tv_usec);57 NewEntryCalled = AddToEntry("\n%s-%s %lu %lu %d-%d-%dT%d:%d:%d ", Issuer, Variable, Time.tv_sec, Time.tv_usec, TM->tm_year+1900,TM->tm_mon+1,TM->tm_mday,TM->tm_hour,TM->tm_min,TM->tm_sec); 54 58 InternalCall = false; 55 59 return NewEntryCalled; -
drsdaq/drsdaq.cpp
r36 r44 62 62 63 63 system("clear"); 64 printf("\n*** ********** DRS readout built %s, %s\n\n",__DATE__,__TIME__);64 printf("\n*** DRS readout built %s, %s (revision %s) *** \n\n",__DATE__, __TIME__, REVISION); 65 65 66 66 // Set signal handlers … … 170 170 return; 171 171 } 172 172 // Allows immediate reuse of socket after closing (circumvents TIME_WAIT) 173 int Value=1; 174 if (setsockopt(ServerSocket, SOL_SOCKET, SO_REUSEADDR, (char *) &Value, sizeof (Value)) == -1) { 175 m->PrintMessage("Warning: Could not set server socket option SO_REUSEADDR (%s)\n", strerror(errno)); 176 } 177 173 178 SocketAddress.sin_family = PF_INET; 174 179 SocketAddress.sin_port = htons((unsigned short) m->fCCPort);
Note:
See TracChangeset
for help on using the changeset viewer.