/** @file StartStopLocal.c * @brief Stand-alone executable
Returns real Start-Stop for VI in DDBase
* Update Start-Stop times in INFO files for LOCAL data
* @details StartStopLocal(string *)
* @arg @c argv[1] Virtual Instrument ID (DD notation)
* Output: YYYYDDdayHHMMSSMLS-YYYYDDdayHHMMSSMLS * * @date 10.10.2007 * @version $Id: StartStopLocal.c,v 1.4 2011/09/05 11:27:34 budnik Exp $ */ #include #include #include #include #include #include #include int DataID, RecID, StartID, StopID; size_t RecNum; char StartT[TIMELENGTH], StopT[TIMELENGTH], Var[128]; size_t count[2] = {1L,TIMELENGTH}; size_t start[2] = {0L,0L}; size_t countVar[2] = {1L,128L}; /*---------------- NC ERROR --------------------------------------*/ void nc_handle_error(int status) { fprintf(stderr, "%s\n", nc_strerror(status)); exit(1); } /* ----------------------- MAIN ------------------------------------*/ int main(int argc, char *argv[]) { int status, len; /* Open VI_times.nc */ if ((status = nc_open(argv[1], NC_NOWRITE, &DataID)) != NC_NOERR) nc_handle_error(status); if ((status = nc_inq_dimid(DataID, "record", &RecID)) != NC_NOERR) nc_handle_error(status); /* Get Number of Records */ if ((status = nc_inq_dimlen(DataID, RecID, &RecNum)) != NC_NOERR) nc_handle_error(status); if ((status = nc_inq_varid(DataID, "StartTime", &StartID)) != NC_NOERR) nc_handle_error(status); if ((status = nc_inq_varid(DataID, "StopTime", &StopID)) != NC_NOERR) nc_handle_error(status); /* Get The First Start and The Last Stop Times */ start[0] = 0; if((status = nc_get_vara_text(DataID, StartID, start, count, StartT)) != NC_NOERR) nc_handle_error(status); start[0] = RecNum-1; if((status = nc_get_vara_text(DataID, StopID, start, count, StopT)) != NC_NOERR) nc_handle_error(status); printf("%s-%s\n", StartT, StopT); if ((status = nc_close(DataID)) != NC_NOERR) nc_handle_error(status); }