Commit 4fb3c975 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Renamed datetimeCmp() to datetimeDiffer().

parent 0adca701
......@@ -9,10 +9,10 @@ typedef struct
DateTime;
static inline int
datetimeCmp(DateTime dt1, DateTime dt2)
datetimeDiffer(DateTime dt1, DateTime dt2)
{
return 2 * ((dt1.date > dt2.date) - (dt1.date < dt2.date))
+ (dt1.time > dt2.time) - (dt1.time < dt2.time);
return (2 * ((dt1.date > dt2.date) - (dt1.date < dt2.date))
+ (dt1.time > dt2.time) - (dt1.time < dt2.time)) != 0;
}
......
......@@ -810,7 +810,7 @@ int cgribexScanTimestep1(stream_t *streamptr)
{
if ( recID < nrecs ) break;
if ( warn_time )
if ( datetimeCmp(datetime, datetime0) != 0 )
if ( datetimeDiffer(datetime, datetime0) )
{
gribWarning("Inconsistent verification time!", nrecs_scanned, tsID+1, paramstr, level1, level2);
warn_time = false;
......@@ -818,7 +818,7 @@ int cgribexScanTimestep1(stream_t *streamptr)
}
else
{
if ( datetimeCmp(datetime, datetime0) != 0 ) break;
if ( datetimeDiffer(datetime, datetime0) ) break;
if ( recID < nrecs )
{
......@@ -1017,7 +1017,7 @@ int cgribexScanTimestep2(stream_t * streamptr)
{
if ( records[recID].used )
{
if ( datetimeCmp(datetime, datetime0) != 0 ) break;
if ( datetimeDiffer(datetime, datetime0) ) break;
gribWarning("Parameter already exist, skipped!", nrecs_scanned, tsID+1, paramstr, level1, level2);
continue;
......@@ -1227,7 +1227,7 @@ int cgribexScanTimestep(stream_t * streamptr)
char paramstr_[32];
cdiParamToString(param, paramstr_, sizeof(paramstr_));
if ( datetimeCmp(datetime, datetime0) != 0 ) break;
if ( datetimeDiffer(datetime, datetime0) ) break;
if ( CDI_Debug )
gribWarning("Parameter already exist, skipped!", nrecs_scanned, tsID+1, paramstr_, level1, level2);
......
......@@ -254,7 +254,7 @@ void extScanTimestep1(stream_t *streamptr)
goto tstepScanLoopFinished;
DateTime datetime = { .date = vdate, .time = vtime};
if ( datetimeCmp(datetime, datetime0) )
if ( datetimeDiffer(datetime, datetime0) )
Warning("Inconsistent verification time for code %d level %d", rcode, rlevel);
}
......
......@@ -17,7 +17,6 @@
#include "calendar.h"
#include "subtype.h"
#include "cgribex.h" /* gribGetSize, gribRead, gribGetZip, GRIB1_LTYPE_99 */
#include "gribapi.h"
......@@ -1001,7 +1000,7 @@ int gribapiScanTimestep1(stream_t * streamptr)
if ( datetime0.date == 10101 && datetime0.time == 0 )
{
if ( datetimeCmp(datetime, datetime0) || !nrecs ) //Do we really need this condition? I have included it in order not to change the number of times gribapiGetDataDateTime() etc. get called. But if those are sideeffect-free, this condition should be removed.
if ( datetimeDiffer(datetime, datetime0) || !nrecs ) //Do we really need this condition? I have included it in order not to change the number of times gribapiGetDataDateTime() etc. get called. But if those are sideeffect-free, this condition should be removed.
{
datetime0 = datetime;
gribapiGetDataDateTime(gh, &rdate, &rtime);
......@@ -1210,7 +1209,7 @@ int gribapiScanTimestep2(stream_t * streamptr)
if ( CDI_inventory_mode == 1 ) break;
else
{
if ( datetimeCmp(datetime, datetime0) != 0 ) break;
if ( datetimeDiffer(datetime, datetime0) ) break;
gribWarning("Parameter already exist, skipped!", nrecs_scanned, tsID+1, varname, param, level1, level2);
continue;
......@@ -1404,7 +1403,7 @@ int gribapiScanTimestep(stream_t * streamptr)
{
if ( records[recID].used )
{
if ( datetimeCmp(datetime, datetime0) != 0 ) break;
if ( datetimeDiffer(datetime, datetime0) ) break;
if ( CDI_Debug )
gribWarning("Parameter already exist, skipped!", nrecs_scanned, tsID+1, varname, param, level1, level2);
......
......@@ -721,7 +721,7 @@ void iegScanTimestep1(stream_t *streamptr)
goto tstepScanLoopFinished;
DateTime datetime = { .date = vdate, .time = vtime};
if ( datetimeCmp(datetime, datetime0) )
if ( datetimeDiffer(datetime, datetime0) )
Warning("Inconsistent verification time for param %d level %d", param, rlevel);
}
......
......@@ -255,7 +255,7 @@ void srvScanTimestep1(stream_t *streamptr)
goto tstepScanLoopFinished;
DateTime datetime = { .date = vdate, .time = vtime };
if ( datetimeCmp(datetime, datetime0) )
if ( datetimeDiffer(datetime, datetime0) )
Warning("Inconsistent verification time for code %d level %d", rcode, rlevel);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment