awips2/ncep/gov.noaa.nws.ncep.viz.rsc.ncgrid/dgdriv_c/dbgtimgrid.c
Brad Gonzales 2a3bf4ec32 Issue #628 committing PGEN code received from Plummer on 4-19-2012.
Former-commit-id: fda897d2d0 [formerly 253e8bc948] [formerly 295cbf95e5 [formerly 0816cd253c86acc699cb90866131619c4679f631]]
Former-commit-id: 295cbf95e5
Former-commit-id: ae3d17c698
2012-05-10 16:50:45 -05:00

62 lines
1.9 KiB
C
Executable file

#include "geminc.h"
#include "gemprm.h"
#include "dbcmn.h"
#include <sys/timeb.h>
void db_gtimgrid ( char *gridTimes, int *lGridTimes, int *iret )
/************************************************************************
* *
* db_gtimgrid *
* *
* m.gamazaychikov/SAIC 11/08 Created *
************************************************************************/
{
int ier, ier1;
char diagMessage[2000];
struct timeb t_callback, t_current;
/*----------------------------------------------------------------------*/
/*
* If the pointer to the callback function is not set, return
*/
if ( fhrsClbkPtr == NULL ) {
ier = -17;
er_wmsg ( "DB", &ier, "db_gtimgrid", &ier1, 2, strlen("db_gtimgrid") );
*iret = -1;
return;
}
/*
* Initialization
*/
*iret = 0;
*lGridTimes = 0;
gridTimes[0] = '\0';
diagMessage[0] = '\0';
/*
* Execute the callback to get the cycle forecast hours
*/
db_msgcave ("db_gtimgrid", "debug", "calling the callback function", &ier);
ftime(&t_callback);
fhrsClbkPtr();
ftime(&t_current);
sprintf (diagMessage, "%s %d", "time spent in callback ", (int) (1000.0 * (t_current.time - t_callback.time) + (t_current.millitm - t_callback.millitm)));
db_msgcave ("db_gtimgrid", "info", diagMessage, &ier);
if ( fhrsStrLength > 0 && fhrsStrBack != NULL ) {
sprintf (gridTimes, "%s", fhrsStrBack);
*lGridTimes = strlen(gridTimes);
G_FREE( fhrsStrBack, char );
sprintf (diagMessage, "%s %s", "got this fhrs string", gridTimes);
db_msgcave ("db_gtimgrid", "debug", diagMessage, &ier);
}
else {
db_msgcave ("db_gtimgrid", "error", "!!! *could not get fhrs string* !!!", &ier);
ier = -18;
er_wmsg ( "DB", &ier, "FcstHrs", &ier1, 2, strlen("FcstHrs") );
*iret = -1;
return;
}
return;
}