void acquire_IncDataFileExt(void) { char *date, mon[10], day[10], yr[10]; //keep current date date = DateStr(); Scan (date, "%s>%s[xt45]%s[xt45]%s", mon, day, yr); Fmt (dataFile.name ,"%s<%s[i2]%s%s", yr, mon, day); // dataFile.ext++; acquire_UpdateDataFileInfo (); }
void M_get_rnd_seed(M_APM mm) { double timer0; int millisec; char *cvi_time, *cvi_date, buf1[64], buf2[32]; M_APM atmp; atmp = M_get_stack_var(); cvi_date = DateStr(); cvi_time = TimeStr(); timer0 = Timer(); /* * note that Timer() is not syncronized to TimeStr(), * but we don't care here since we are just looking * for a random source of digits. */ millisec = (int)(0.01 + 1000.0 * (timer0 - floor(timer0))); sprintf(buf1, "%d", millisec); buf2[0] = cvi_time[6]; /* time format: "HH:MM:SS" */ buf2[1] = cvi_time[7]; buf2[2] = cvi_time[3]; buf2[3] = cvi_time[4]; buf2[4] = cvi_time[0]; buf2[5] = cvi_time[1]; buf2[6] = cvi_date[3]; /* date format: "MM-DD-YYYY" */ buf2[7] = cvi_date[4]; buf2[8] = cvi_date[0]; buf2[9] = cvi_date[1]; buf2[10] = cvi_date[8]; buf2[11] = cvi_date[9]; buf2[12] = cvi_date[7]; buf2[13] = '4'; buf2[14] = '7'; buf2[15] = '\0'; strcat(buf1, buf2); m_apm_set_string(atmp, buf1); atmp->m_apm_exponent = 15; m_apm_integer_divide(mm, atmp, MM_One); M_restore_stack(1); }
void acquire_Init (void) { char *date, mon[10], day[10], yr[10]; if (utilG.acq.status != ACQ_NONE) { util_ChangeInitMessage ("Acquisition Utilities..."); acqG.p.setup = LoadPanel (utilG.p, "acquireu.uir", ACQSETUP); //SetPanelPos (acqG.p.setup, VAL_AUTO_CENTER, VAL_AUTO_CENTER); GetProjectDir (dataFile.dir); date = DateStr(); Scan (date, "%s>%s[xt45]%s[xt45]%s", mon, day, yr); Fmt (dataFile.name ,"%s<%s[i2]%s%s", yr, mon, day); dataFile.ext = 1; acquire_UpdateDataFileInfo(); InstallCtrlCallback (utilG.p, BG_ACQSETUP, AcqSetupCallback, 0); } else SetCtrlAttribute (utilG.p, BG_ACQSETUP, ATTR_VISIBLE, FALSE); }
int DataFileControlCallback(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { char name[256]; char *date, mon[10], day[10], yr[10]; int ext, err, size; if (event == EVENT_VAL_CHANGED) { //keep current date date = DateStr(); Scan (date, "%s>%s[xt45]%s[xt45]%s", mon, day, yr); Fmt (dataFile.name ,"%s<%s[i2]%s%s", yr, mon, day); // Fmt (name, dataFile.name); ext = dataFile.ext; GetCtrlVal (panel, ACQSETUP_FILENAME, dataFile.name); GetCtrlVal (panel, ACQSETUP_FILEEXT, &dataFile.ext); acquire_DataFileMakePath(); SetCtrlVal (panel, ACQSETUP_FILEPATH, dataFile.path); } return 0; }