/** @file GetStartTime.c
* @brief Stand-alone executable
Returns real Start for given VI in DDBase
*
* @details GetStartTime(string *)
* @arg \c argv[1] Full name of *_times.nc
*
*/
#include
#include
#include
#include
#include
#include
#include
int DataID, StartID;
double StartStamp;
char StartT[TIMELENGTH];
size_t count[2] = {1L,TIMELENGTH};
size_t start[2] = {0L,0L};
/*---------------- 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;
if (argc < 2){
fprintf(stderr,"Usage: GetStartTime *_times.nc\n");
exit(1);
}
// Open VI_times.nc
if ((status = nc_open(argv[1], NC_NOWRITE, &DataID)) != NC_NOERR)
nc_handle_error(status);
if ((status = nc_inq_varid(DataID, "StartTime", &StartID)) != NC_NOERR)
nc_handle_error(status);
// Get The First Start
if((status = nc_get_vara_text(DataID, StartID, start, count, StartT)) != NC_NOERR)
nc_handle_error(status);
StartStamp = DD_Time2Double(StartT);
printf("%f\n", StartStamp);
if ((status = nc_close(DataID)) != NC_NOERR) nc_handle_error(status);
}