#include "dcltng.h" void lt_gtim ( int endianness, unsigned char *bullx, int *ibxptr, int *ibfdt, f77r8 *year, f77r8 *month, f77r8 *day, f77r8 *hour, f77r8 *minute, f77r8 *second ) /************************************************************************ * lt_gtim * * * * This routine reads the next 6 bytes of a lightning report as a * * UNIX time_t (# of seconds since 1 Jan 1970 00:00:00 UTC) value and * * computes and returns the corresponding time components. The byte * * ordering can be big-endian or little-endian and is specified during * * input. * * * * Input parameters: * * ENDIANNESS INT Byte-ordering scheme within bulletin: * * 0 = big-endian * * 1 = little-endian * * BULLX CHAR* Lightning bulletin * * IBXPTR INT* Pointer within BULLX * * * * Output parameters: * * IBXPTR INT* Updated pointer within BULLX * * YEAR F77R8* Year * * MONTH F77R8* Month * * DAY F77R8* Day * * HOUR F77R8* Hour * * MINUTE F77R8* Minute * * SECOND F77R8* Second * * IBFDT INT* Date-time as YYYYMMDDHH * ** * * Log: * * J. Ator/NCEP 05/15 * ***********************************************************************/ { time_t nsecs; struct tm *rpttim; /* The first 4 bytes contain the time_t value. */ nsecs = (time_t) lt_word( endianness, bullx, ibxptr ); rpttim = gmtime( &nsecs ); *year = (*rpttim).tm_year + 1900; *month = (*rpttim).tm_mon + 1; *day = (*rpttim).tm_mday; *hour = (*rpttim).tm_hour; *minute = (*rpttim).tm_min; /* The next 2 bytes contain the milliseconds. */ *second = (*rpttim).tm_sec + ( (float) lt_shrt( endianness, bullx, ibxptr ) ) / 1000.; *ibfdt = ( (unsigned) *year * 1000000 ) + ( (unsigned) *month * 10000 ) + ( (unsigned) *day * 100 ) + (unsigned) *hour; return; }